1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-27 22:38:09 +02:00

refactor contexts

This commit is contained in:
Jesse Duffield
2022-02-05 17:04:10 +11:00
parent 145c69d9ae
commit d82f175e79
54 changed files with 1562 additions and 1248 deletions

View File

@@ -15,17 +15,12 @@ func (gui *Gui) getSelectedSuggestionValue() string {
}
func (gui *Gui) getSelectedSuggestion() *types.Suggestion {
selectedLine := gui.State.Panels.Suggestions.SelectedLineIdx
if selectedLine == -1 {
return nil
}
return gui.State.Suggestions[selectedLine]
return gui.State.Contexts.Suggestions.GetSelected()
}
func (gui *Gui) setSuggestions(suggestions []*types.Suggestion) {
gui.State.Suggestions = suggestions
gui.State.Panels.Suggestions.SelectedLineIdx = 0
gui.State.Contexts.Suggestions.SetSelectedLineIdx(0)
_ = gui.resetOrigin(gui.Views.Suggestions)
_ = gui.State.Contexts.Suggestions.HandleRender()
}