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.
This commit is contained in:
parent
f15811a737
commit
00b9ca5032
1 changed files with 6 additions and 4 deletions
|
@ -269,11 +269,13 @@ func (aerc *Aerc) Logger() *log.Logger {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aerc *Aerc) SelectedAccount() *AccountView {
|
func (aerc *Aerc) SelectedAccount() *AccountView {
|
||||||
acct, ok := aerc.accounts[aerc.tabs.Tabs[aerc.tabs.Selected].Name]
|
switch tab := aerc.SelectedTab().(type) {
|
||||||
if !ok {
|
case *AccountView:
|
||||||
return nil
|
return tab
|
||||||
|
case *MessageViewer:
|
||||||
|
return tab.SelectedAccount()
|
||||||
}
|
}
|
||||||
return acct
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aerc *Aerc) SelectedTab() ui.Drawable {
|
func (aerc *Aerc) SelectedTab() ui.Drawable {
|
||||||
|
|
Loading…
Reference in a new issue