mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-26 05:37:18 +02:00
fix branches select sig
This commit is contained in:
parent
0822a9296c
commit
b0fe963f8a
@ -21,15 +21,14 @@ func (gui *Gui) getSelectedBranch() *commands.Branch {
|
|||||||
return gui.State.Branches[selectedLine]
|
return gui.State.Branches[selectedLine]
|
||||||
}
|
}
|
||||||
|
|
||||||
// may want to standardise how these select methods work
|
func (gui *Gui) handleBranchSelect() error {
|
||||||
func (gui *Gui) handleBranchSelect(g *gocui.Gui, v *gocui.View) 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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ func (gui *Gui) handleBranchSelect(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return gui.newStringTask("main", gui.Tr.SLocalize("NoBranchesThisRepo"))
|
return gui.newStringTask("main", gui.Tr.SLocalize("NoBranchesThisRepo"))
|
||||||
}
|
}
|
||||||
branch := gui.getSelectedBranch()
|
branch := gui.getSelectedBranch()
|
||||||
v.FocusPoint(0, gui.State.Panels.Branches.SelectedLine)
|
gui.getBranchesView().FocusPoint(0, gui.State.Panels.Branches.SelectedLine)
|
||||||
|
|
||||||
if gui.inDiffMode() {
|
if gui.inDiffMode() {
|
||||||
return gui.renderDiff()
|
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)
|
displayStrings := presentation.GetBranchListDisplayStrings(gui.State.Branches, gui.State.ScreenMode != SCREEN_NORMAL, gui.State.Diff.Ref)
|
||||||
gui.renderDisplayStrings(branchesView, displayStrings)
|
gui.renderDisplayStrings(branchesView, displayStrings)
|
||||||
if gui.g.CurrentView() == branchesView {
|
if gui.g.CurrentView() == branchesView {
|
||||||
if err := gui.handleBranchSelect(gui.g, branchesView); err != nil {
|
if err := gui.handleBranchSelect(); err != nil {
|
||||||
return gui.surfaceError(err)
|
return gui.surfaceError(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -516,7 +515,7 @@ func (gui *Gui) onBranchesPanelSearchSelect(selectedLine int) error {
|
|||||||
switch branchesView.Context {
|
switch branchesView.Context {
|
||||||
case "local-branches":
|
case "local-branches":
|
||||||
gui.State.Panels.Branches.SelectedLine = selectedLine
|
gui.State.Panels.Branches.SelectedLine = selectedLine
|
||||||
return gui.handleBranchSelect(gui.g, branchesView)
|
return gui.handleBranchSelect()
|
||||||
case "remotes":
|
case "remotes":
|
||||||
gui.State.Panels.Remotes.SelectedLine = selectedLine
|
gui.State.Panels.Remotes.SelectedLine = selectedLine
|
||||||
return gui.handleRemoteSelect(gui.g, branchesView)
|
return gui.handleRemoteSelect(gui.g, branchesView)
|
||||||
|
@ -132,8 +132,8 @@ func (gui *Gui) getListViews() []*listView {
|
|||||||
context: "local-branches",
|
context: "local-branches",
|
||||||
getItemsLength: func() int { return len(gui.State.Branches) },
|
getItemsLength: func() int { return len(gui.State.Branches) },
|
||||||
getSelectedLineIdxPtr: func() *int { return &gui.State.Panels.Branches.SelectedLine },
|
getSelectedLineIdxPtr: func() *int { return &gui.State.Panels.Branches.SelectedLine },
|
||||||
handleFocus: gui.handleBranchSelect,
|
handleFocus: gui.wrappedHandler(gui.handleBranchSelect),
|
||||||
handleItemSelect: gui.handleBranchSelect,
|
handleItemSelect: gui.wrappedHandler(gui.handleBranchSelect),
|
||||||
gui: gui,
|
gui: gui,
|
||||||
rendersToMainView: true,
|
rendersToMainView: true,
|
||||||
},
|
},
|
||||||
|
@ -228,7 +228,7 @@ func (gui *Gui) newLineFocused(g *gocui.Gui, v *gocui.View) error {
|
|||||||
branchesView := gui.getBranchesView()
|
branchesView := gui.getBranchesView()
|
||||||
switch branchesView.Context {
|
switch branchesView.Context {
|
||||||
case "local-branches":
|
case "local-branches":
|
||||||
return gui.handleBranchSelect(g, v)
|
return gui.handleBranchSelect()
|
||||||
case "remotes":
|
case "remotes":
|
||||||
return gui.handleRemoteSelect(g, v)
|
return gui.handleRemoteSelect(g, v)
|
||||||
case "remote-branches":
|
case "remote-branches":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user