refactor: use term/input

This commit is contained in:
Ayman Bagabas
2024-03-06 13:56:40 -05:00
parent e3823b2f22
commit c6d2541152
6 changed files with 49 additions and 39 deletions
+8 -3
View File
@@ -17,8 +17,10 @@ import (
)
// Internal messages for clipboard operations.
type pasteMsg string
type pasteErrMsg struct{ error }
type (
pasteMsg string
pasteErrMsg struct{ error }
)
// EchoMode sets the input behavior of the text input field.
type EchoMode int
@@ -621,13 +623,16 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
m.previousSuggestion()
default:
// Input one or more regular characters.
m.insertRunesFromUserInput(msg.Runes)
m.insertRunesFromUserInput([]rune{msg.Rune})
}
// Check again if can be completed
// because value might be something that does not match the completion prefix
m.updateSuggestions()
case tea.PasteMsg:
m.insertRunesFromUserInput([]rune(msg))
case pasteMsg:
m.insertRunesFromUserInput([]rune(msg))