From a067ce1f41daa99268bde34206b99b462f063ad1 Mon Sep 17 00:00:00 2001 From: 2pac Date: Fri, 17 Apr 2020 19:42:48 +0200 Subject: [PATCH] implemented circular tab movement (#1619) Co-authored-by: 2pac --- internal/action/actions.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/action/actions.go b/internal/action/actions.go index ed4151f8..fd363281 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -1447,8 +1447,9 @@ func (h *BufPane) AddTab() bool { // PreviousTab switches to the previous tab in the tab list func (h *BufPane) PreviousTab() bool { - a := Tabs.Active() - Tabs.SetActive(util.Clamp(a-1, 0, len(Tabs.List)-1)) + tabsLen := len(Tabs.List) + a := Tabs.Active() + tabsLen + Tabs.SetActive((a - 1) % tabsLen) return true } @@ -1456,7 +1457,8 @@ func (h *BufPane) PreviousTab() bool { // NextTab switches to the next tab in the tab list func (h *BufPane) NextTab() bool { a := Tabs.Active() - Tabs.SetActive(util.Clamp(a+1, 0, len(Tabs.List)-1)) + Tabs.SetActive((a + 1) % len(Tabs.List)) + return true }