summaryrefslogtreecommitdiffstats
path: root/pkg/gui
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 22:07:14 +1100
commitf0cd730fbb025d5c9068913f5ef11c5082617209 (patch)
tree17cff5ae004837da148501004e3edadc55faaa12 /pkg/gui
parent2afbd7ba7fcd3668d7c70b831e525741e6214bd5 (diff)
ensure we switch tabs when switching context
Diffstat (limited to 'pkg/gui')
-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()