Fix backspace keybinding

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

View File

@ -36,6 +36,8 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
case tea.KeyMsg:
switch msg.Type {
case tea.KeyBackspace:
fallthrough
case tea.KeyDelete:
if len(m.Value) > 0 {
m.Value = m.Value[:m.pos-1] + m.Value[m.pos:]
m.pos--