diff options
author | Robin Jarry <robin@jarry.cc> | 2022-12-27 22:59:10 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-02-20 14:48:42 +0100 |
commit | d2e74cdb91e140b50d14c3a8b315cde272f32587 (patch) | |
tree | 4f4a20c02f60b67d7a8eb967bb45d789a057453b /widgets/account.go | |
parent | 6af06c9dfec03e923589d34187ba8358e3423d5c (diff) | |
download | aerc-d2e74cdb91e140b50d14c3a8b315cde272f32587.tar.gz |
statusline: add column based render format
In the spirit of commit 535300cfdbfc ("config: add columns based index
format"), reuse the column definitions and table widget.
Add automatic translation of render-format to column definitions. Allow
empty columns to be compatible with the %m (mute) flag.
Rename the State object to AccountState to be more precise. Reuse that
object in state.TempateData to expose account state info. Move actual
status line rendering in StatusLine.Draw().
Add new template fields for status specific data:
{{.ConnectionInfo}}
Connection state.
{{.ContentInfo}}
General status information (e.g. filter, search)
{{.StatusInfo}}
Combination of {{.ConnectionInfo}} and {{.StatusInfo}}
{{.TrayInfo}}
General on/off information (e.g. passthrough, threading,
sorting)
{{.PendingKeys}}
Currently pressed key sequence that does not match any key
binding and/or is incomplete.
Display a warning on startup if render-format has been converted to
status-columns.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'widgets/account.go')
-rw-r--r-- | widgets/account.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/widgets/account.go b/widgets/account.go index 135afef2..5b5d4dcd 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -35,7 +35,7 @@ type AccountView struct { tab *ui.Tab msglist *MessageList worker *types.Worker - state *state.State + state state.AccountState newConn bool // True if this is a first run after a new connection/reconnection uiConf *config.UIConfig @@ -66,7 +66,6 @@ func NewAccountView( acct: acct, aerc: aerc, host: host, - state: state.NewState(acct.Name, len(config.Accounts) > 1), uiConf: acctUiConf, } @@ -117,14 +116,14 @@ func NewAccountView( func (acct *AccountView) SetStatus(setters ...state.SetStateFunc) { for _, fn := range setters { - fn(acct.state, acct.SelectedDirectory()) + fn(&acct.state, acct.SelectedDirectory()) } acct.UpdateStatus() } func (acct *AccountView) UpdateStatus() { if acct.isSelected() { - acct.host.SetStatus(acct.state.StatusLine(acct.SelectedDirectory())) + acct.host.UpdateStatus() } } @@ -157,9 +156,6 @@ func (acct *AccountView) Invalidate() { } func (acct *AccountView) Draw(ctx *ui.Context) { - if acct.state.SetWidth(ctx.Width()) { - acct.UpdateStatus() - } acct.grid.Draw(ctx) } @@ -480,7 +476,7 @@ func (acct *AccountView) CheckMailTimer(d time.Duration) { go func() { defer log.PanicHandler() for range acct.ticker.C { - if !acct.state.Connected() { + if !acct.state.Connected { continue } acct.CheckMail() |