Add ^A and ^E keybindings

This commit is contained in:
Christian Rocha
2020-01-29 21:46:03 -05:00
parent 48e19e3b0d
commit 501f9cbbe1
3 changed files with 14 additions and 3 deletions

View File

@@ -51,6 +51,12 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
m.pos++
}
return m, nil
case tea.KeyCtrlA: // ^A, beginning
m.pos = 0
return m, nil
case tea.KeyCtrlE: // ^E, end
m.pos = len(m.Value) - 1
return m, nil
case tea.KeyRune:
m.Value = m.Value[:m.pos] + msg.String() + m.Value[m.pos:]
m.pos++