diff --git a/textinput/textinput.go b/textinput/textinput.go index 501f9a7..24e0b6e 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -830,6 +830,10 @@ func (m *Model) AvailableSuggestions() []string { // CurrentSuggestion returns the currently selected suggestion. func (m *Model) CurrentSuggestion() string { + if m.currentSuggestionIndex >= len(m.matchedSuggestions) { + return "" + } + return string(m.matchedSuggestions[m.currentSuggestionIndex]) }