aboutsummaryrefslogtreecommitdiff
path: root/widgets/aerc.go
diff options
context:
space:
mode:
authorJeffas <dev@jeffas.io>2019-10-01 18:01:49 +0100
committerDrew DeVault <sir@cmpwn.com>2019-10-02 15:40:23 -0400
commit00b9ca503286d5dc43def31db713e853c8aeee13 (patch)
tree789905527978005483e5f5604af8098e941ad9a4 /widgets/aerc.go
parentf15811a737ee8d93f22ceff620df145c2d252b15 (diff)
Fix selected account to return for messageviewer
This ensures that the selectedaccount is returned if currently selected tab is a messageviewer. This also makes it more extensible for adding other ways of getting the selected account.
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r--widgets/aerc.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 16fe8b7..af51a0f 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -269,11 +269,13 @@ func (aerc *Aerc) Logger() *log.Logger {
}
func (aerc *Aerc) SelectedAccount() *AccountView {
- acct, ok := aerc.accounts[aerc.tabs.Tabs[aerc.tabs.Selected].Name]
- if !ok {
- return nil
+ switch tab := aerc.SelectedTab().(type) {
+ case *AccountView:
+ return tab
+ case *MessageViewer:
+ return tab.SelectedAccount()
}
- return acct
+ return nil
}
func (aerc *Aerc) SelectedTab() ui.Drawable {