diff options
author | kt programs <ktprograms@gmail.com> | 2022-03-06 10:58:07 +0800 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-03-07 10:18:50 +0100 |
commit | cc172970a079bb78847f2276db8bfae375cda185 (patch) | |
tree | 143f9f049d7faf01e6ab1b07aac5017c516efbb2 /commands/ct.go | |
parent | 55ae3d2cab8489609a1b11c169c28306730a71ea (diff) | |
download | aerc-cc172970a079bb78847f2276db8bfae375cda185.tar.gz |
commands: implement fuzzy completion for commands and options
Change the option to enable fuzzy completion to be fuzzy-complete, since
it's no longer only used for folders
Signed-off-by: Kt Programs <ktprograms@gmail.com>
Acked-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'commands/ct.go')
-rw-r--r-- | commands/ct.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/commands/ct.go b/commands/ct.go index 7764cab8..f5f2cca9 100644 --- a/commands/ct.go +++ b/commands/ct.go @@ -20,17 +20,16 @@ func (ChangeTab) Aliases() []string { } func (ChangeTab) Complete(aerc *widgets.Aerc, args []string) []string { + acct := aerc.SelectedAccount() + if acct == nil { + return make([]string, 0) + } + if len(args) == 0 { return aerc.TabNames() } joinedArgs := strings.Join(args, " ") - out := make([]string, 0) - for _, tab := range aerc.TabNames() { - if strings.HasPrefix(tab, joinedArgs) { - out = append(out, tab) - } - } - return out + return FilterList(aerc.TabNames(), joinedArgs, "", acct.UiConfig().FuzzyComplete) } func (ChangeTab) Execute(aerc *widgets.Aerc, args []string) error { |