aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-10-30 20:45:57 +0100
committerRobin Jarry <robin@jarry.cc>2023-10-30 23:24:36 +0100
commitd4c9d0a28adfa04f22d302a7976b3e4777924786 (patch)
tree367cb3ba7904a1b213b0ab00a467f77ff972fcca
parentcce91fc55e65b02eea4faa61082e9c701a091c59 (diff)
downloadaerc-d4c9d0a28adfa04f22d302a7976b3e4777924786.tar.gz
aerc-d4c9d0a28adfa04f22d302a7976b3e4777924786.zip
cf: do not quote notmuch queries in completion results
Notmuch queries should not be quoted, they will be interpreted by the notmuch library. Make sure not to return quoted results for directories which have the role == "query". Reported-by: Inwit <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--commands/account/cf.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/commands/account/cf.go b/commands/account/cf.go
index fe225e61..d8d615aa 100644
--- a/commands/account/cf.go
+++ b/commands/account/cf.go
@@ -7,6 +7,7 @@ import (
"git.sr.ht/~rjarry/aerc/app"
"git.sr.ht/~rjarry/aerc/commands"
"git.sr.ht/~rjarry/aerc/lib/state"
+ "git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/handlers"
"git.sr.ht/~rjarry/aerc/worker/types"
"git.sr.ht/~rjarry/go-opt"
@@ -28,7 +29,20 @@ func (ChangeFolder) Aliases() []string {
}
func (*ChangeFolder) CompleteFolder(arg string) []string {
- return commands.GetFolders(arg)
+ acct := app.SelectedAccount()
+ if acct == nil {
+ return nil
+ }
+ return commands.FilterList(
+ acct.Directories().List(), arg,
+ func(s string) string {
+ dir := acct.Directories().Directory(s)
+ if dir != nil && dir.Role != models.QueryRole {
+ s = opt.QuoteArg(s)
+ }
+ return s
+ },
+ )
}
func (c ChangeFolder) Execute(args []string) error {