Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(textinput): expose UpdateSuggestions method #630

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions textinput/textinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (m *Model) SetSuggestions(suggestions []string) {
m.suggestions[i] = []rune(s)
}

m.updateSuggestions()
m.UpdateSuggestions()
}

// rsan initializes or retrieves the rune sanitizer.
Expand Down Expand Up @@ -621,7 +621,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {

// Check again if can be completed
// because value might be something that does not match the completion prefix
m.updateSuggestions()
m.UpdateSuggestions()

case pasteMsg:
m.insertRunesFromUserInput([]rune(msg))
Expand Down Expand Up @@ -851,8 +851,8 @@ func (m *Model) canAcceptSuggestion() bool {
return len(m.matchedSuggestions) > 0
}

// updateSuggestions refreshes the list of matching suggestions.
func (m *Model) updateSuggestions() {
// UpdateSuggestions refreshes the list of matching suggestions.
func (m *Model) UpdateSuggestions() {
if !m.ShowSuggestions {
return
}
Expand Down
2 changes: 1 addition & 1 deletion textinput/textinput_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func Test_CurrentSuggestion(t *testing.T) {
}

textinput.SetValue("test")
textinput.updateSuggestions()
textinput.UpdateSuggestions()
textinput.nextSuggestion()
suggestion = textinput.CurrentSuggestion()
expected = "test2"
Expand Down
Loading