From feecc09b73e2c904be42f271e0c10574b98a95ea Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Mon, 21 Mar 2022 22:18:51 +0100 Subject: statusline: make statusline folder-specific Make statusline folder-specific. Update filter, search and threading status when changing folders. Commit 2512c04 ("statusline: implement per-account status") introduced an account-specific statusline. This makes it account- and folder-specific. Signed-off-by: Koni Marti Tested-by: Moritz Poldrack --- widgets/account.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'widgets') diff --git a/widgets/account.go b/widgets/account.go index 5d1315c..1d31923 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -32,7 +32,6 @@ type AccountView struct { msglist *MessageList worker *types.Worker state *statusline.State - update bool } func (acct *AccountView) UiConfig() config.UIConfig { @@ -112,13 +111,13 @@ func (acct *AccountView) Tick() bool { func (acct *AccountView) SetStatus(setters ...statusline.SetStateFunc) { for _, fn := range setters { - fn(acct.state) + fn(acct.state, acct.SelectedDirectory()) } - acct.update = true + acct.UpdateStatus() } func (acct *AccountView) UpdateStatus() { - acct.host.SetStatus(acct.state.String()) + acct.host.SetStatus(acct.state.StatusLine(acct.SelectedDirectory())) } func (acct *AccountView) PushStatus(status string, expiry time.Duration) { @@ -160,10 +159,6 @@ func (acct *AccountView) Invalidate() { } func (acct *AccountView) Draw(ctx *ui.Context) { - if acct.update { - acct.UpdateStatus() - acct.update = false - } acct.grid.Draw(ctx) } @@ -322,6 +317,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { acct.logger.Printf("%v", msg.Error) acct.PushError(msg.Error) } + acct.UpdateStatus() } func (acct *AccountView) getSortCriteria() []*types.SortCriterion { -- cgit v1.2.3