1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-24 05:36:19 +02:00

fix remote branches select sig

This commit is contained in:
Jesse Duffield 2020-08-15 16:52:04 +10:00
parent 43f8bae267
commit 17b84e09c0
4 changed files with 8 additions and 8 deletions

View File

@ -521,7 +521,7 @@ func (gui *Gui) onBranchesPanelSearchSelect(selectedLine int) error {
return gui.handleRemoteSelect() return gui.handleRemoteSelect()
case "remote-branches": case "remote-branches":
gui.State.Panels.RemoteBranches.SelectedLine = selectedLine gui.State.Panels.RemoteBranches.SelectedLine = selectedLine
return gui.handleRemoteBranchSelect(gui.g, branchesView) return gui.handleRemoteBranchSelect()
} }
return nil return nil
} }

View File

@ -153,8 +153,8 @@ func (gui *Gui) getListViews() []*listView {
context: "remote-branches", context: "remote-branches",
getItemsLength: func() int { return len(gui.State.RemoteBranches) }, getItemsLength: func() int { return len(gui.State.RemoteBranches) },
getSelectedLineIdxPtr: func() *int { return &gui.State.Panels.RemoteBranches.SelectedLine }, getSelectedLineIdxPtr: func() *int { return &gui.State.Panels.RemoteBranches.SelectedLine },
handleFocus: gui.handleRemoteBranchSelect, handleFocus: gui.wrappedHandler(gui.handleRemoteBranchSelect),
handleItemSelect: gui.handleRemoteBranchSelect, handleItemSelect: gui.wrappedHandler(gui.handleRemoteBranchSelect),
gui: gui, gui: gui,
rendersToMainView: true, rendersToMainView: true,
}, },

View File

@ -19,14 +19,14 @@ func (gui *Gui) getSelectedRemoteBranch() *commands.RemoteBranch {
return gui.State.RemoteBranches[selectedLine] return gui.State.RemoteBranches[selectedLine]
} }
func (gui *Gui) handleRemoteBranchSelect(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) handleRemoteBranchSelect() error {
if gui.popupPanelFocused() { if gui.popupPanelFocused() {
return nil return nil
} }
gui.State.SplitMainPanel = false gui.State.SplitMainPanel = false
if _, err := gui.g.SetCurrentView(v.Name()); err != nil { if _, err := gui.g.SetCurrentView("branches"); err != nil {
return err 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") 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() { if gui.inDiffMode() {
return gui.renderDiff() return gui.renderDiff()
@ -64,7 +64,7 @@ func (gui *Gui) renderRemoteBranchesWithSelection() error {
displayStrings := presentation.GetRemoteBranchListDisplayStrings(gui.State.RemoteBranches, gui.State.Diff.Ref) displayStrings := presentation.GetRemoteBranchListDisplayStrings(gui.State.RemoteBranches, gui.State.Diff.Ref)
gui.renderDisplayStrings(branchesView, displayStrings) gui.renderDisplayStrings(branchesView, displayStrings)
if gui.g.CurrentView() == branchesView && branchesView.Context == "remote-branches" { 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 return err
} }
} }

View File

@ -232,7 +232,7 @@ func (gui *Gui) newLineFocused(g *gocui.Gui, v *gocui.View) error {
case "remotes": case "remotes":
return gui.handleRemoteSelect() return gui.handleRemoteSelect()
case "remote-branches": case "remote-branches":
return gui.handleRemoteBranchSelect(g, v) return gui.handleRemoteBranchSelect()
case "tags": case "tags":
return gui.handleTagSelect(g, v) return gui.handleTagSelect(g, v)
default: default: