Don't render suggestions when textinput is not focused.

This can look confusing in forms otherwise.
This commit is contained in:
Pierre Rossi
2025-01-28 09:24:43 -05:00
committed by Christian Rocha
parent 1bdd4c6fb3
commit 0f9e38c9a7
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -665,7 +665,7 @@ func (m Model) View() string {
v += styleText(m.echoTransform(string(value[pos+1:]))) // text after cursor
v += m.completionView(0) // suggested completion
} else {
if m.canAcceptSuggestion() {
if m.focus && m.canAcceptSuggestion() {
suggestion := m.matchedSuggestions[m.currentSuggestionIndex]
if len(value) < len(suggestion) {
m.Cursor.TextStyle = m.CompletionStyle