diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-15 16:48:35 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-15 18:01:43 +1000 |
commit | b0fe963f8a82ec06856e2f55b520146fbddb2a8c (patch) | |
tree | 25eeabeb4c37d07ef47ca4c0af26c6ee69861786 /pkg/gui/branches_panel.go | |
parent | 0822a9296c1e5f4c43b30b60d40ce870057f3494 (diff) |
fix branches select sig
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r-- | pkg/gui/branches_panel.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index df7825ed2..0e5477ef7 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -21,15 +21,14 @@ func (gui *Gui) getSelectedBranch() *commands.Branch { return gui.State.Branches[selectedLine] } -// may want to standardise how these select methods work -func (gui *Gui) handleBranchSelect(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleBranchSelect() error { if gui.popupPanelFocused() { return nil } gui.State.SplitMainPanel = false - if _, err := gui.g.SetCurrentView(v.Name()); err != nil { + if _, err := gui.g.SetCurrentView("branches"); err != nil { return err } @@ -40,7 +39,7 @@ func (gui *Gui) handleBranchSelect(g *gocui.Gui, v *gocui.View) error { return gui.newStringTask("main", gui.Tr.SLocalize("NoBranchesThisRepo")) } branch := gui.getSelectedBranch() - v.FocusPoint(0, gui.State.Panels.Branches.SelectedLine) + gui.getBranchesView().FocusPoint(0, gui.State.Panels.Branches.SelectedLine) if gui.inDiffMode() { return gui.renderDiff() @@ -92,7 +91,7 @@ func (gui *Gui) renderLocalBranchesWithSelection() error { displayStrings := presentation.GetBranchListDisplayStrings(gui.State.Branches, gui.State.ScreenMode != SCREEN_NORMAL, gui.State.Diff.Ref) gui.renderDisplayStrings(branchesView, displayStrings) if gui.g.CurrentView() == branchesView { - if err := gui.handleBranchSelect(gui.g, branchesView); err != nil { + if err := gui.handleBranchSelect(); err != nil { return gui.surfaceError(err) } } @@ -516,7 +515,7 @@ func (gui *Gui) onBranchesPanelSearchSelect(selectedLine int) error { switch branchesView.Context { case "local-branches": gui.State.Panels.Branches.SelectedLine = selectedLine - return gui.handleBranchSelect(gui.g, branchesView) + return gui.handleBranchSelect() case "remotes": gui.State.Panels.Remotes.SelectedLine = selectedLine return gui.handleRemoteSelect(gui.g, branchesView) |