diff options
author | Robin Jarry <robin@jarry.cc> | 2023-10-30 20:45:57 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-11-02 11:59:39 +0100 |
commit | c4e6de9d59cc534171fd0ef9fa51995e70a8b32e (patch) | |
tree | 322621d1ffa8c45bf08a28b3e0a6904e6ef7f128 | |
parent | 2dfeb7130a8fb97d927a55efa738f110f46cb688 (diff) | |
download | aerc-c4e6de9d59cc534171fd0ef9fa51995e70a8b32e.tar.gz |
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>
Tested-by: Inwit <inwit@sindominio.net>
-rw-r--r-- | commands/account/cf.go | 16 |
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 { |