feat!: use bubbletea@v2-exp

This commit is contained in:
Ayman Bagabas
2024-09-09 14:12:52 -04:00
parent d3bd075ed2
commit a93bfef532
14 changed files with 48 additions and 36 deletions
+6 -3
View File
@@ -555,7 +555,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
}
// Need to check for completion before, because key is configurable and might be double assigned
keyMsg, ok := msg.(tea.KeyMsg)
keyMsg, ok := msg.(tea.KeyPressMsg)
if ok && key.Matches(keyMsg, m.KeyMap.AcceptSuggestion) {
if m.canAcceptSuggestion() {
m.value = append(m.value, m.matchedSuggestions[m.currentSuggestionIndex][len(m.value):]...)
@@ -568,7 +568,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
oldPos := m.pos //nolint
switch msg := msg.(type) {
case tea.KeyMsg:
case tea.KeyPressMsg:
switch {
case key.Matches(msg, m.KeyMap.DeleteWordBackward):
m.deleteWordBackward()
@@ -616,13 +616,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.Text))
}
// 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))