about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJeffas <dev@jeffas.io>2019-10-10 13:09:45 +0100
committerDrew DeVault <sir@cmpwn.com>2019-10-14 10:38:02 -0400
commit2542c65af2c24c94d70e8ab51cc590fe8fc3bd28 (patch)
treeba09364540eefc2f9b3646259a1353bc63feb436
parentf1b365dfc30b7253f3baea270ebcc8d1fb754db9 (diff)
downloadaerc-2542c65af2c24c94d70e8ab51cc590fe8fc3bd28.tar.gz
Fix pushing invalid tabs to history
A tab can now only be pushed onto the history if it is a selectable tab.
-rw-r--r--lib/ui/tab.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index 9c19cd7..ef9fcd8 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -107,7 +107,10 @@ func (tabs *Tabs) Select(index int) {
 	}
 
 	if tabs.Selected != index {
-		tabs.pushHistory(tabs.Selected)
+		// only push valid tabs onto the history
+		if tabs.Selected < len(tabs.Tabs) {
+			tabs.pushHistory(tabs.Selected)
+		}
 		tabs.Selected = index
 		tabs.TabStrip.Invalidate()
 		tabs.TabContent.Invalidate()