diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 1222fe3f3..8752ada99 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -521,7 +521,7 @@ func (gui *Gui) onBranchesPanelSearchSelect(selectedLine int) error { return gui.handleRemoteSelect() case "remote-branches": gui.State.Panels.RemoteBranches.SelectedLine = selectedLine - return gui.handleRemoteBranchSelect(gui.g, branchesView) + return gui.handleRemoteBranchSelect() } return nil } diff --git a/pkg/gui/list_view.go b/pkg/gui/list_view.go index aaf7a8f40..ccec0b60e 100644 --- a/pkg/gui/list_view.go +++ b/pkg/gui/list_view.go @@ -153,8 +153,8 @@ func (gui *Gui) getListViews() []*listView { context: "remote-branches", getItemsLength: func() int { return len(gui.State.RemoteBranches) }, getSelectedLineIdxPtr: func() *int { return &gui.State.Panels.RemoteBranches.SelectedLine }, - handleFocus: gui.handleRemoteBranchSelect, - handleItemSelect: gui.handleRemoteBranchSelect, + handleFocus: gui.wrappedHandler(gui.handleRemoteBranchSelect), + handleItemSelect: gui.wrappedHandler(gui.handleRemoteBranchSelect), gui: gui, rendersToMainView: true, }, diff --git a/pkg/gui/remote_branches_panel.go b/pkg/gui/remote_branches_panel.go index bc84acd21..2c9ae6b9b 100644 --- a/pkg/gui/remote_branches_panel.go +++ b/pkg/gui/remote_branches_panel.go @@ -19,14 +19,14 @@ func (gui *Gui) getSelectedRemoteBranch() *commands.RemoteBranch { return gui.State.RemoteBranches[selectedLine] } -func (gui *Gui) handleRemoteBranchSelect(g *gocui.Gui, v *gocui.View) error { +func (gui *Gui) handleRemoteBranchSelect() 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 } @@ -37,7 +37,7 @@ func (gui *Gui) handleRemoteBranchSelect(g *gocui.Gui, v *gocui.View) error { return gui.newStringTask("main", "No branches for this remote") } - v.FocusPoint(0, gui.State.Panels.RemoteBranches.SelectedLine) + gui.getBranchesView().FocusPoint(0, gui.State.Panels.RemoteBranches.SelectedLine) if gui.inDiffMode() { return gui.renderDiff() @@ -64,7 +64,7 @@ func (gui *Gui) renderRemoteBranchesWithSelection() error { displayStrings := presentation.GetRemoteBranchListDisplayStrings(gui.State.RemoteBranches, gui.State.Diff.Ref) gui.renderDisplayStrings(branchesView, displayStrings) if gui.g.CurrentView() == branchesView && branchesView.Context == "remote-branches" { - if err := gui.handleRemoteBranchSelect(gui.g, branchesView); err != nil { + if err := gui.handleRemoteBranchSelect(); err != nil { return err } } diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index c4d54cdee..d9a9c0a94 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -232,7 +232,7 @@ func (gui *Gui) newLineFocused(g *gocui.Gui, v *gocui.View) error { case "remotes": return gui.handleRemoteSelect() case "remote-branches": - return gui.handleRemoteBranchSelect(g, v) + return gui.handleRemoteBranchSelect() case "tags": return gui.handleTagSelect(g, v) default: