This begins a big refactor of moving more code out of the Gui struct into contexts, controllers, and helpers. We also move some code into structs in the gui package purely for the sake of better encapsulation
27 lines
637 B
Go
27 lines
637 B
Go
package gui
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
|
)
|
|
|
|
func (gui *Gui) getSelectedSuggestionValue() string {
|
|
selectedSuggestion := gui.getSelectedSuggestion()
|
|
|
|
if selectedSuggestion != nil {
|
|
return selectedSuggestion.Value
|
|
}
|
|
|
|
return ""
|
|
}
|
|
|
|
func (gui *Gui) getSelectedSuggestion() *types.Suggestion {
|
|
return gui.State.Contexts.Suggestions.GetSelected()
|
|
}
|
|
|
|
func (gui *Gui) setSuggestions(suggestions []*types.Suggestion) {
|
|
gui.State.Suggestions = suggestions
|
|
gui.State.Contexts.Suggestions.SetSelectedLineIdx(0)
|
|
gui.c.ResetViewOrigin(gui.Views.Suggestions)
|
|
_ = gui.State.Contexts.Suggestions.HandleRender()
|
|
}
|