diff --git a/input/input.go b/input/input.go index 09952a3..e443a0e 100644 --- a/input/input.go +++ b/input/input.go @@ -43,11 +43,15 @@ 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++ @@ -68,6 +72,10 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) { m.Value = m.Value[:m.pos] m.pos = len(m.Value) return m, nil + case tea.KeyCtrlU: // ^U, kill text before cursor + m.Value = m.Value[m.pos:] + m.pos = 0 + return m, nil case tea.KeyRune: m.Value = m.Value[:m.pos] + msg.String() + m.Value[m.pos:] m.pos++