From 73a23207d2a90b720b2f88816025d2cd37dc6105 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 17 Feb 2021 09:38:35 +0100 Subject: [PATCH] Added more bash-like key bindings to InputField. Resolves #549 --- inputfield.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inputfield.go b/inputfield.go index 858bcc3..d1e3394 100644 --- a/inputfield.go +++ b/inputfield.go @@ -554,7 +554,7 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p if i.offset >= i.cursorPos { i.offset = 0 } - case tcell.KeyDelete: // Delete character after the cursor. + case tcell.KeyDelete, tcell.KeyCtrlD: // Delete character after the cursor. iterateString(i.text[i.cursorPos:], func(main rune, comb []rune, textPos, textWidth, screenPos, screenWidth int) bool { i.text = i.text[:i.cursorPos] + i.text[i.cursorPos+textWidth:] return true @@ -565,12 +565,16 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p } else { moveLeft() } + case tcell.KeyCtrlB: + moveLeft() case tcell.KeyRight: if event.Modifiers()&tcell.ModAlt > 0 { moveWordRight() } else { moveRight() } + case tcell.KeyCtrlF: + moveRight() case tcell.KeyHome, tcell.KeyCtrlA: home() case tcell.KeyEnd, tcell.KeyCtrlE: