From 088d63ce934c34e113a5b3154dfcf91b49132067 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Wed, 15 Mar 2023 20:38:37 +0100 Subject: tabs: make sure to close tab content Rework how tabs are closed. Change the aerc.RemoveTab and aerc.ReplaceTab functions to accept a new boolean argument. If true, make sure to close the tab content. Signed-off-by: Robin Jarry --- lib/ui/interfaces.go | 4 ++++ lib/ui/tab.go | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go index 757f81c9..a28c6c29 100644 --- a/lib/ui/interfaces.go +++ b/lib/ui/interfaces.go @@ -16,6 +16,10 @@ type Drawable interface { Invalidate() } +type Closeable interface { + Close() +} + type RootDrawable interface { Initialize(ui *UI) } diff --git a/lib/ui/tab.go b/lib/ui/tab.go index d336d646..b992a8a2 100644 --- a/lib/ui/tab.go +++ b/lib/ui/tab.go @@ -1,7 +1,6 @@ package ui import ( - "io" "sync" "github.com/gdamore/tcell/v2" @@ -116,9 +115,6 @@ func (tabs *Tabs) Replace(contentSrc Drawable, contentTarget Drawable, name stri if tab.Content == contentSrc { tabs.tabs[i] = replaceTab tabs.selectPriv(i) - if c, ok := contentSrc.(io.Closer); ok { - c.Close() - } break } } -- cgit