1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-23 12:18:51 +02:00

ensure we switch tabs when switching context

This commit is contained in:
Jesse Duffield 2019-11-17 13:25:28 +11:00
parent 2afbd7ba7f
commit f0cd730fbb

View File

@ -367,11 +367,18 @@ func (gui *Gui) onBranchesTabClick(tabIndex int) error {
return gui.switchBranchesPanelContext(contexts[tabIndex]) return gui.switchBranchesPanelContext(contexts[tabIndex])
} }
// TODO: make this switch tabs as well if necessary
func (gui *Gui) switchBranchesPanelContext(context string) error { func (gui *Gui) switchBranchesPanelContext(context string) error {
branchesView := gui.getBranchesView() branchesView := gui.getBranchesView()
branchesView.Context = context branchesView.Context = context
contextTabIndexMap := map[string]int{
"local-branches": 0,
"remotes": 1,
"remote-branches": 1,
}
branchesView.TabIndex = contextTabIndexMap[context]
switch context { switch context {
case "local-branches": case "local-branches":
return gui.renderLocalBranchesWithSelection() return gui.renderLocalBranchesWithSelection()