diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-16 17:35:59 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-21 22:07:14 +1100 |
commit | 986abc1e45e314e68beb7c0ba92804e60c99310b (patch) | |
tree | 788b7f689a051c414bec231489279f0f41a949bd /pkg/gui/branches_panel.go | |
parent | 61dac10bb94874800d7b955c875cbcc3b3efa546 (diff) |
support viewing a remote branch
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r-- | pkg/gui/branches_panel.go | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index cd1a9a69b..54a9301e2 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -338,18 +338,38 @@ func (gui *Gui) handleFastForward(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) onBranchesTabClick(tabIndex int) error { contexts := []string{"local-branches", "remotes", "tabs"} branchesView := gui.getBranchesView() - branchesView.Context = contexts[tabIndex] branchesView.TabIndex = tabIndex - switch contexts[tabIndex] { + 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 + + switch context { case "local-branches": if err := gui.renderListPanel(branchesView, gui.State.Branches); err != nil { return err } + if err := gui.handleBranchSelect(gui.g, gui.getBranchesView()); err != nil { + return err + } case "remotes": if err := gui.renderListPanel(branchesView, gui.State.Remotes); err != nil { return err } + if err := gui.handleRemoteSelect(gui.g, gui.getBranchesView()); err != nil { + return err + } + case "remote-branches": + if err := gui.renderListPanel(branchesView, gui.State.RemoteBranches); err != nil { + return err + } + if err := gui.handleRemoteBranchSelect(gui.g, gui.getBranchesView()); err != nil { + return err + } } return nil |