diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-11-28 19:53:39 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-11-28 20:48:17 +1100 |
commit | be404068ffeda8eb43246db77f67573aae3079f3 (patch) | |
tree | cd6496b4f044124f90c1af22d415cf8e6f06ed8f /pkg/gui/suggestions_panel.go | |
parent | 5671ec5f5867c3c2b083563bac309c8616b322ae (diff) |
support labels for suggestions which are distinct from values
Diffstat (limited to 'pkg/gui/suggestions_panel.go')
-rw-r--r-- | pkg/gui/suggestions_panel.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/pkg/gui/suggestions_panel.go b/pkg/gui/suggestions_panel.go index eb3b7808a..9f5469496 100644 --- a/pkg/gui/suggestions_panel.go +++ b/pkg/gui/suggestions_panel.go @@ -1,15 +1,27 @@ package gui -func (gui *Gui) getSelectedSuggestion() string { +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 { selectedLine := gui.State.Panels.Suggestions.SelectedLineIdx if selectedLine == -1 { - return "" + return nil } return gui.State.Suggestions[selectedLine] } -func (gui *Gui) setSuggestions(suggestions []string) { +func (gui *Gui) setSuggestions(suggestions []*types.Suggestion) { view := gui.getSuggestionsView() if view == nil { return |