search/filter: remove from status bar after 20 seconds

The status is not cleared. It is annoying.

Fixes: c37f1eaaea ("filter/search: display current search/filter arguments")
Signed-off-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Robin Jarry 2022-02-19 22:26:47 +01:00
parent bca93cd915
commit e384203390
1 changed files with 5 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package account
import ( import (
"errors" "errors"
"fmt" "fmt"
"time"
"git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/widgets"
) )
@ -33,16 +34,16 @@ 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" {
aerc.SetStatus("Filtering...") aerc.PushStatus("Filtering...", 10*time.Second)
cb = func(uids []uint32) { cb = func(uids []uint32) {
aerc.SetStatus(fmt.Sprintf("Filter complete %s", args)) aerc.PushStatus(fmt.Sprintf("Filter complete %s", args), 20*time.Second)
acct.Logger().Printf("Filter results: %v", uids) acct.Logger().Printf("Filter results: %v", uids)
store.ApplyFilter(uids) store.ApplyFilter(uids)
} }
} else { } else {
aerc.SetStatus("Searching...") aerc.PushStatus("Searching...", 10*time.Second)
cb = func(uids []uint32) { cb = func(uids []uint32) {
aerc.SetStatus(fmt.Sprintf("Search complete %s", args)) aerc.PushStatus(fmt.Sprintf("Search complete %s", args), 20*time.Second)
acct.Logger().Printf("Search results: %v", uids) acct.Logger().Printf("Search results: %v", uids)
store.ApplySearch(uids) store.ApplySearch(uids)
// TODO: Remove when stores have multiple OnUpdate handlers // TODO: Remove when stores have multiple OnUpdate handlers