diff options
author | Jeffas <dev@jeffas.io> | 2019-10-01 18:01:49 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-10-02 15:40:23 -0400 |
commit | 00b9ca503286d5dc43def31db713e853c8aeee13 (patch) | |
tree | 789905527978005483e5f5604af8098e941ad9a4 | |
parent | f15811a737ee8d93f22ceff620df145c2d252b15 (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.
-rw-r--r-- | widgets/aerc.go | 10 |
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 { |