mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
fix(textinput): out of range panic if no matched suggestions (#473)
* fix(textinput): out of range panic if no matched suggestions * fix(textinput): out of bounds check Co-authored-by: Maas Lalani <maas@lalani.dev> --------- Co-authored-by: Maas Lalani <maas@lalani.dev>
This commit is contained in:
co-authored by
Maas Lalani
parent
364eac96a8
commit
79cc9621d5
@@ -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])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user