diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2023-01-26 10:16:43 -0600 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-01-29 21:47:11 +0100 |
commit | 6b39c0dae1e1c42445a2d8557e48135b02fc729b (patch) | |
tree | d65d2898424178203c0be52c56c255f96f8d51ee /lib/ui | |
parent | db60d7edeceaec075f91a802968c397698798d50 (diff) | |
download | aerc-6b39c0dae1e1c42445a2d8557e48135b02fc729b.tar.gz |
tabs: use template for account tab name
Use a go template to render the account tab display. Add config option
for setting a specific template for the account. Add a method on Tab to
allow setting a title, which may be different than the tab Name.
The default template is {{.Account}}.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/ui')
-rw-r--r-- | lib/ui/tab.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ui/tab.go b/lib/ui/tab.go index d4841efc..d336d646 100644 --- a/lib/ui/tab.go +++ b/lib/ui/tab.go @@ -30,6 +30,11 @@ type Tab struct { pinned bool indexBeforePin int uiConf *config.UIConfig + title string +} + +func (t *Tab) SetTitle(s string) { + t.title = s } type ( @@ -351,6 +356,9 @@ func (strip *TabStrip) Draw(ctx *Context) { tabWidth = ctx.Width() - x - 2 } name := tab.Name + if tab.title != "" { + name = tab.title + } if tab.pinned { name = uiConfig.PinnedTabMarker + name } |