Sort keybindings

This commit is contained in:
Christian Rocha 2020-02-20 09:44:58 -05:00
parent 2c07ebb669
commit 318f47a6aa
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -82,20 +82,20 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
m.pos--
}
return m, nil
case tea.KeyCtrlF: // ^F, forward one character
fallthrough
case tea.KeyLeft:
if m.pos > 0 {
m.pos--
}
return m, nil
case tea.KeyCtrlB: // ^B, back one charcter
fallthrough
case tea.KeyRight:
if m.pos < len(m.Value) {
m.pos++
}
return m, nil
case tea.KeyCtrlF: // ^F, forward one character
fallthrough
case tea.KeyCtrlB: // ^B, back one charcter
fallthrough
case tea.KeyCtrlA: // ^A, beginning
m.pos = 0
return m, nil