filter: clear filter when called with no args

Clear filter when called with no arguments.

Fixes: https://todo.sr.ht/~rjarry/aerc/35
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Koni Marti 2022-04-18 16:21:54 +02:00 committed by Robin Jarry
parent ce18e92881
commit 25a8a00c55
1 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,9 @@ func (SearchFilter) Execute(aerc *widgets.Aerc, args []string) error {
var cb func([]uint32) var cb func([]uint32)
if args[0] == "filter" { if args[0] == "filter" {
if len(args[1:]) == 0 {
return Clear{}.Execute(aerc, []string{"clear"})
}
acct.SetStatus(statusline.FilterActivity("Filtering..."), statusline.Search("")) acct.SetStatus(statusline.FilterActivity("Filtering..."), statusline.Search(""))
cb = func(uids []uint32) { cb = func(uids []uint32) {
acct.SetStatus(statusline.FilterResult(strings.Join(args, " "))) acct.SetStatus(statusline.FilterResult(strings.Join(args, " ")))