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 <koni.marti@gmail.com>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
This commit is contained in:
parent
e56648029f
commit
feecc09b73
4 changed files with 67 additions and 46 deletions
widgets
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue