Revert "fix panic on closing a tab"
This reverts commit d7feb56cbe
.
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>
This commit is contained in:
parent
5e600d7ab4
commit
f642fc9038
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue