aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/aerc.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r--widgets/aerc.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 70083860..352bcadd 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -117,13 +117,8 @@ func NewAerc(
return
case *AccountWizard:
return
- case *Composer:
- aerc.RemoveTab(content)
- content.Close()
- case *Terminal:
- content.Close(nil)
- case *MessageViewer:
- aerc.RemoveTab(content)
+ default:
+ aerc.RemoveTab(content, true)
}
}
@@ -485,13 +480,19 @@ func (aerc *Aerc) NewTab(clickable ui.Drawable, name string) *ui.Tab {
return tab
}
-func (aerc *Aerc) RemoveTab(tab ui.Drawable) {
+func (aerc *Aerc) RemoveTab(tab ui.Drawable, closeContent bool) {
aerc.tabs.Remove(tab)
aerc.UpdateStatus()
+ if content, ok := tab.(ui.Closeable); ok && closeContent {
+ content.Close()
+ }
}
-func (aerc *Aerc) ReplaceTab(tabSrc ui.Drawable, tabTarget ui.Drawable, name string) {
+func (aerc *Aerc) ReplaceTab(tabSrc ui.Drawable, tabTarget ui.Drawable, name string, closeSrc bool) {
aerc.tabs.Replace(tabSrc, tabTarget, name)
+ if content, ok := tabSrc.(ui.Closeable); ok && closeSrc {
+ content.Close()
+ }
}
func (aerc *Aerc) MoveTab(i int, relative bool) {