Add ^K keybinding

This commit is contained in:
Christian Rocha 2020-01-29 21:51:52 -05:00
parent 501f9cbbe1
commit 86dbd03c1e
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -57,6 +57,10 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
case tea.KeyCtrlE: // ^E, end
m.pos = len(m.Value) - 1
return m, nil
case tea.KeyCtrlK: // ^K, kill text after cursor
m.Value = m.Value[:m.pos]
m.pos = len(m.Value)
return m, nil
case tea.KeyRune:
m.Value = m.Value[:m.pos] + msg.String() + m.Value[m.pos:]
m.pos++