summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-11-17 13:25:28 +1100
committerJesse Duffield <jessedduffield@gmail.com>2019-11-21 21:15:49 +1100
commitcb9aa6083072f1dbc2d06a619f4910b7bdf356d0 (patch)
tree17cff5ae004837da148501004e3edadc55faaa12
parent25177dfd2b52db8b47c0af0837c0345d252e96df (diff)
ensure we switch tabs when switching context
-rw-r--r--pkg/gui/branches_panel.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index 154149a33..dabe995cb 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -367,11 +367,18 @@ func (gui *Gui) onBranchesTabClick(tabIndex int) error {
return gui.switchBranchesPanelContext(contexts[tabIndex])
}
-// TODO: make this switch tabs as well if necessary
func (gui *Gui) switchBranchesPanelContext(context string) error {
branchesView := gui.getBranchesView()
branchesView.Context = context
+ contextTabIndexMap := map[string]int{
+ "local-branches": 0,
+ "remotes": 1,
+ "remote-branches": 1,
+ }
+
+ branchesView.TabIndex = contextTabIndexMap[context]
+
switch context {
case "local-branches":
return gui.renderLocalBranchesWithSelection()