diff options
author | Jeffas <dev@jeffas.io> | 2019-07-19 18:12:57 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-07-23 10:27:59 -0400 |
commit | e42b95a617399b2736df96ae6469309e6b306d71 (patch) | |
tree | 65bd6f78faa0607a3d73a35b7c59a713472adbea /widgets/aerc.go | |
parent | d526786c9358bc92a5ffc3233e0ba4491aff07ba (diff) | |
download | aerc-e42b95a617399b2736df96ae6469309e6b306d71.tar.gz |
Add change tab command
This command allows the user to change tab by giving the tab name. This can be tab completed too. The previous tab is stored in the tabs module so that when a new tab is created it is still possible to go to the previous one. Normal invocation is :ct folder Previous tab is :ct -
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r-- | widgets/aerc.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go index 14cf3c4..079d442 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -252,6 +252,28 @@ func (aerc *Aerc) PrevTab() { aerc.tabs.Select(next) } +func (aerc *Aerc) SelectTab(name string) bool { + for i, tab := range aerc.tabs.Tabs { + if tab.Name == name { + aerc.tabs.Select(i) + return true + } + } + return false +} + +func (aerc *Aerc) TabNames() []string { + var names []string + for _, tab := range aerc.tabs.Tabs { + names = append(names, tab.Name) + } + return names +} + +func (aerc *Aerc) SelectPreviousTab() bool { + return aerc.tabs.SelectPrevious() +} + // TODO: Use per-account status lines, but a global ex line func (aerc *Aerc) SetStatus(status string) *StatusMessage { return aerc.statusline.Set(status) |