mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-23 12:18:51 +02:00
eagerload commits when searching
This commit is contained in:
parent
46be280c92
commit
1f5ccab1ce
@ -675,3 +675,15 @@ func (gui *Gui) onCommitsPanelSearchSelect(selectedLine int) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleOpenSearchForCommitsPanel(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.refreshCommits(gui.g); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return gui.handleOpenSearch(gui.g, v)
|
||||||
|
}
|
||||||
|
@ -640,6 +640,12 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: gui.handlePrevCommitsTab,
|
Handler: gui.handlePrevCommitsTab,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "commits",
|
||||||
|
Key: gui.getKey("universal.startSearch"),
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleOpenSearchForCommitsPanel,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
Contexts: []string{"branch-commits"},
|
Contexts: []string{"branch-commits"},
|
||||||
@ -1436,8 +1442,12 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.nextItem"), Modifier: gocui.ModNone, Handler: listView.handleNextLine},
|
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.nextItem"), 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.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},
|
||||||
{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.startSearch"), Modifier: gocui.ModNone, Handler: gui.handleOpenSearch},
|
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
|
// we need a specific keybinding for the commits panel beacuse it usually lazyloads commits
|
||||||
|
if listView.viewName != "commits" {
|
||||||
|
bindings = append(bindings, &Binding{ViewName: listView.viewName, Contexts: []string{listView.context}, Key: gui.getKey("universal.startSearch"), Modifier: gocui.ModNone, Handler: gui.handleOpenSearch})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bindings
|
return bindings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user