mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-09 13:47:11 +02:00
support lazyloading in commits view
This commit is contained in:
parent
229f5ee48c
commit
fbb767893e
@ -668,3 +668,21 @@ func (gui *Gui) handleResetCherryPick(g *gocui.Gui, v *gocui.View) error {
|
|||||||
gui.State.CherryPickedCommits = []*commands.Commit{}
|
gui.State.CherryPickedCommits = []*commands.Commit{}
|
||||||
return gui.renderBranchCommitsWithSelection()
|
return gui.renderBranchCommitsWithSelection()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleGotoBottomForCommitsPanel(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
// we usually lazyload these commits but now that we're searching we need to load them now
|
||||||
|
if gui.State.Panels.Commits.LimitCommits {
|
||||||
|
gui.State.Panels.Commits.LimitCommits = false
|
||||||
|
if err := gui.refreshSidePanels(refreshOptions{mode: SYNC, scope: []int{COMMITS}}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, view := range gui.getListViews() {
|
||||||
|
if view.viewName == "commits" {
|
||||||
|
return view.handleGotoBottom(g, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -683,13 +683,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
Handler: gui.handlePrevCommitsTab,
|
Handler: gui.handlePrevCommitsTab,
|
||||||
Description: gui.Tr.SLocalize("prevTab"),
|
Description: gui.Tr.SLocalize("prevTab"),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
ViewName: "commits",
|
|
||||||
Key: gui.getKey("universal.startSearch"),
|
|
||||||
Modifier: gocui.ModNone,
|
|
||||||
Handler: gui.handleOpenSearchForCommitsPanel,
|
|
||||||
Description: gui.Tr.SLocalize("startSearch"),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{"branch-commits"},
|
Contexts: []string{"branch-commits"},
|
||||||
@ -1513,22 +1506,34 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.prevPage"), Modifier: gocui.ModNone, Handler: listView.handlePrevPage},
|
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.prevPage"), Modifier: gocui.ModNone, Handler: listView.handlePrevPage},
|
||||||
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.nextPage"), Modifier: gocui.ModNone, Handler: listView.handleNextPage},
|
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.nextPage"), Modifier: gocui.ModNone, Handler: listView.handleNextPage},
|
||||||
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.gotoTop"), Modifier: gocui.ModNone, Handler: listView.handleGotoTop},
|
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.gotoTop"), Modifier: gocui.ModNone, Handler: listView.handleGotoTop},
|
||||||
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.gotoBottom"), Modifier: gocui.ModNone, Handler: listView.handleGotoBottom},
|
|
||||||
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gocui.MouseWheelDown, Modifier: gocui.ModNone, Handler: listView.handleNextLine},
|
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gocui.MouseWheelDown, Modifier: gocui.ModNone, Handler: listView.handleNextLine},
|
||||||
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gocui.MouseLeft, Modifier: gocui.ModNone, Handler: listView.handleClick},
|
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gocui.MouseLeft, Modifier: gocui.ModNone, Handler: listView.handleClick},
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
// we need a specific keybinding for the commits panel beacuse it usually lazyloads commits
|
// the commits panel needs to lazyload things so it has a couple of its own handlers
|
||||||
if listView.viewName != "commits" {
|
openSearchHandler := gui.handleOpenSearch
|
||||||
bindings = append(bindings, &Binding{
|
gotoBottomHandler := listView.handleGotoBottom
|
||||||
|
if listView.viewName == "commits" {
|
||||||
|
openSearchHandler = gui.handleOpenSearchForCommitsPanel
|
||||||
|
gotoBottomHandler = gui.handleGotoBottomForCommitsPanel
|
||||||
|
}
|
||||||
|
|
||||||
|
bindings = append(bindings, []*Binding{
|
||||||
|
{
|
||||||
ViewName: listView.viewName,
|
ViewName: listView.viewName,
|
||||||
Contexts: []string{listView.context},
|
|
||||||
Key: gui.getKey("universal.startSearch"),
|
Key: gui.getKey("universal.startSearch"),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handleOpenSearch,
|
Handler: openSearchHandler,
|
||||||
Description: gui.Tr.SLocalize("startSearch"),
|
Description: gui.Tr.SLocalize("startSearch"),
|
||||||
})
|
},
|
||||||
}
|
{
|
||||||
|
ViewName: listView.viewName,
|
||||||
|
Contexts: []string{listView.context},
|
||||||
|
Key: gui.getKey("universal.gotoBottom"),
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gotoBottomHandler,
|
||||||
|
},
|
||||||
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bindings
|
return bindings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user