mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-01-11 14:38:10 +03:00
Correct ^F/^B keybindings for forward/back cursor movement
This commit is contained in:
parent
ce7d8da084
commit
8148e61443
@ -473,28 +473,24 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case tea.KeyLeft:
|
case tea.KeyLeft, tea.KeyCtrlB:
|
||||||
if msg.Alt { // alt+left arrow, back one word
|
if msg.Alt { // alt+left arrow, back one word
|
||||||
resetBlink = m.wordLeft()
|
resetBlink = m.wordLeft()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if m.pos > 0 {
|
if m.pos > 0 { // left arrow, ^F, back one character
|
||||||
resetBlink = m.SetCursor(m.pos - 1)
|
resetBlink = m.SetCursor(m.pos - 1)
|
||||||
}
|
}
|
||||||
case tea.KeyRight:
|
case tea.KeyRight, tea.KeyCtrlF:
|
||||||
if msg.Alt { // alt+right arrow, forward one word
|
if msg.Alt { // alt+right arrow, forward one word
|
||||||
resetBlink = m.wordRight()
|
resetBlink = m.wordRight()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if m.pos < len(m.value) {
|
if m.pos < len(m.value) { // right arrow, ^F, forward one word
|
||||||
resetBlink = m.SetCursor(m.pos + 1)
|
resetBlink = m.SetCursor(m.pos + 1)
|
||||||
}
|
}
|
||||||
case tea.KeyCtrlW: // ^W, delete word left of cursor
|
case tea.KeyCtrlW: // ^W, delete word left of cursor
|
||||||
resetBlink = m.deleteWordLeft()
|
resetBlink = m.deleteWordLeft()
|
||||||
case tea.KeyCtrlF: // ^F, forward one character
|
|
||||||
fallthrough
|
|
||||||
case tea.KeyCtrlB: // ^B, back one charcter
|
|
||||||
fallthrough
|
|
||||||
case tea.KeyHome, tea.KeyCtrlA: // ^A, go to beginning
|
case tea.KeyHome, tea.KeyCtrlA: // ^A, go to beginning
|
||||||
resetBlink = m.CursorStart()
|
resetBlink = m.CursorStart()
|
||||||
case tea.KeyDelete, tea.KeyCtrlD: // ^D, delete char under cursor
|
case tea.KeyDelete, tea.KeyCtrlD: // ^D, delete char under cursor
|
||||||
|
Loading…
Reference in New Issue
Block a user