From 43f8bae267e57a8ff642173746f5384d533848a9 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 15 Aug 2020 16:50:30 +1000 Subject: [PATCH] fix remotes select sig --- pkg/gui/branches_panel.go | 2 +- pkg/gui/list_view.go | 2 +- pkg/gui/remotes_panel.go | 8 ++++---- pkg/gui/view_helpers.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 0e5477ef7..1222fe3f3 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -518,7 +518,7 @@ func (gui *Gui) onBranchesPanelSearchSelect(selectedLine int) error { return gui.handleBranchSelect() case "remotes": gui.State.Panels.Remotes.SelectedLine = selectedLine - return gui.handleRemoteSelect(gui.g, branchesView) + return gui.handleRemoteSelect() case "remote-branches": gui.State.Panels.RemoteBranches.SelectedLine = selectedLine return gui.handleRemoteBranchSelect(gui.g, branchesView) diff --git a/pkg/gui/list_view.go b/pkg/gui/list_view.go index c488a3cad..aaf7a8f40 100644 --- a/pkg/gui/list_view.go +++ b/pkg/gui/list_view.go @@ -143,7 +143,7 @@ func (gui *Gui) getListViews() []*listView { getItemsLength: func() int { return len(gui.State.Remotes) }, getSelectedLineIdxPtr: func() *int { return &gui.State.Panels.Remotes.SelectedLine }, handleFocus: gui.wrappedHandler(gui.renderRemotesWithSelection), - handleItemSelect: gui.handleRemoteSelect, + handleItemSelect: gui.wrappedHandler(gui.handleRemoteSelect), handleClickSelectedItem: gui.handleRemoteEnter, gui: gui, rendersToMainView: true, diff --git a/pkg/gui/remotes_panel.go b/pkg/gui/remotes_panel.go index 9de7d56e8..353716e99 100644 --- a/pkg/gui/remotes_panel.go +++ b/pkg/gui/remotes_panel.go @@ -22,14 +22,14 @@ func (gui *Gui) getSelectedRemote() *commands.Remote { return gui.State.Remotes[selectedLine] } -func (gui *Gui) handleRemoteSelect(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleRemoteSelect() 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 } @@ -39,7 +39,7 @@ func (gui *Gui) handleRemoteSelect(g *gocui.Gui, v *gocui.View) error { if remote == nil { return gui.newStringTask("main", "No remotes") } - v.FocusPoint(0, gui.State.Panels.Remotes.SelectedLine) + gui.getBranchesView().FocusPoint(0, gui.State.Panels.Remotes.SelectedLine) if gui.inDiffMode() { return gui.renderDiff() @@ -88,7 +88,7 @@ func (gui *Gui) renderRemotesWithSelection() error { gui.renderDisplayStrings(branchesView, displayStrings) if gui.g.CurrentView() == branchesView && branchesView.Context == "remotes" { - if err := gui.handleRemoteSelect(gui.g, branchesView); err != nil { + if err := gui.handleRemoteSelect(); err != nil { return err } } diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index 5845eacde..c4d54cdee 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -230,7 +230,7 @@ func (gui *Gui) newLineFocused(g *gocui.Gui, v *gocui.View) error { case "local-branches": return gui.handleBranchSelect() case "remotes": - return gui.handleRemoteSelect(g, v) + return gui.handleRemoteSelect() case "remote-branches": return gui.handleRemoteBranchSelect(g, v) case "tags":