summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--commands/terminal/close.go1
-rw-r--r--lib/ui/tab.go5
2 files changed, 5 insertions, 1 deletions
diff --git a/commands/terminal/close.go b/commands/terminal/close.go
index 35c4799..8256e67 100644
--- a/commands/terminal/close.go
+++ b/commands/terminal/close.go
@@ -26,6 +26,5 @@ func (_ Close) Execute(aerc *widgets.Aerc, args []string) error {
 	}
 	term, _ := aerc.SelectedTab().(*widgets.Terminal)
 	term.Close(nil)
-	aerc.RemoveTab(term)
 	return nil
 }
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index a9b24a9..6ee5575 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -57,13 +57,18 @@ func (tabs *Tabs) invalidateChild(d Drawable) {
 }
 
 func (tabs *Tabs) Remove(content Drawable) {
+	match := false
 	for i, tab := range tabs.Tabs {
 		if tab.Content == content {
 			tabs.Tabs = append(tabs.Tabs[:i], tabs.Tabs[i+1:]...)
 			tabs.removeHistory(i)
+			match = true
 			break
 		}
 	}
+	if !match {
+		return
+	}
 	index, ok := tabs.popHistory()
 	if ok {
 		tabs.Select(index)