aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ui/tab.go
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2022-07-18 11:00:05 +0200
committerRobin Jarry <robin@jarry.cc>2022-07-18 13:06:59 +0200
commitf642fc90385ad521d32415b1fb5449becbe1a566 (patch)
tree5d41043a13b497ed30f5e64f9bd15aea7e9af169 /lib/ui/tab.go
parent5e600d7ab46b68d317d6700fe0d730cc5db44ec0 (diff)
downloadaerc-f642fc90385ad521d32415b1fb5449becbe1a566.tar.gz
Revert "fix panic on closing a tab"
This reverts commit d7feb56cbe7b81160b580ec2f5dcaef78c7a2230. This commit introduced a regression in which upon closing any but the last tab caused an out of range panic would occur. Steps to reproduce - open a tab - open another tab - close the first tab Fixes: https://todo.sr.ht/~rjarry/aerc/58 Reported-by: akspecs <akspecs@gmail.com> Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/ui/tab.go')
-rw-r--r--lib/ui/tab.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index 3be512f7..a67bdabc 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -74,13 +74,10 @@ func (tabs *Tabs) invalidateChild(d Drawable) {
func (tabs *Tabs) Remove(content Drawable) {
indexToRemove := -1
- removeTab := func() {}
for i, tab := range tabs.Tabs {
if tab.Content == content {
- removeTab = func() {
- tabs.Tabs = append(tabs.Tabs[:i], tabs.Tabs[i+1:]...)
- tabs.removeHistory(i)
- }
+ tabs.Tabs = append(tabs.Tabs[:i], tabs.Tabs[i+1:]...)
+ tabs.removeHistory(i)
indexToRemove = i
break
}
@@ -102,7 +99,6 @@ func (tabs *Tabs) Remove(content Drawable) {
// selected tab is now one to the left of where it was
tabs.Selected--
}
- removeTab()
tabs.TabStrip.Invalidate()
}