diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-19 19:26:05 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | e4beaf4de96afee804d019e7c19eee833d3b1801 (patch) | |
tree | e432775a74aa78a533799da888a55dc55e233e66 /pkg/gui/branches_panel.go | |
parent | d4f134c6c7476e42ccd011a22bd31a195a6bc88d (diff) |
more stuff
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r-- | pkg/gui/branches_panel.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 59a1e9f8f..80e7e154a 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -439,23 +439,22 @@ func (gui *Gui) handleFastForward(g *gocui.Gui, v *gocui.View) error { return nil } -func (gui *Gui) onBranchesTabClick(tabIndex int) error { - branchesView := gui.getBranchesView() - branchesView.TabIndex = tabIndex - - context := gui.ViewTabContextMap["branches"][tabIndex].contexts[0] +func (gui *Gui) onViewTabClick(viewName string, tabIndex int) error { + context := gui.ViewTabContextMap[viewName][tabIndex].contexts[0] return gui.switchContext(context) } -func (gui *Gui) handleNextBranchesTab(g *gocui.Gui, v *gocui.View) error { - return gui.onBranchesTabClick( +func (gui *Gui) handleNextTab(g *gocui.Gui, v *gocui.View) error { + return gui.onViewTabClick( + v.Name(), utils.ModuloWithWrap(v.TabIndex+1, len(v.Tabs)), ) } -func (gui *Gui) handlePrevBranchesTab(g *gocui.Gui, v *gocui.View) error { - return gui.onBranchesTabClick( +func (gui *Gui) handlePrevTab(g *gocui.Gui, v *gocui.View) error { + return gui.onViewTabClick( + v.Name(), utils.ModuloWithWrap(v.TabIndex-1, len(v.Tabs)), ) } |