From 61a4cf388aac73e417df122b357b43a5dbe90f41 Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Mon, 5 Nov 2018 11:09:49 +0100 Subject: [PATCH] Another fix for InputField. Fixes #176, resolves #177 --- inputfield.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/inputfield.go b/inputfield.go index 3205d72..c6b1a17 100644 --- a/inputfield.go +++ b/inputfield.go @@ -374,12 +374,7 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p // Process key event. switch key := event.Key(); key { case tcell.KeyRune: // Regular character. - modifiers := event.Modifiers() - if modifiers == tcell.ModNone { - if !add(event.Rune()) { - break - } - } else if modifiers&tcell.ModAlt > 0 { + if event.Modifiers()&tcell.ModAlt > 0 { // We accept some Alt- key combinations. switch event.Rune() { case 'a': // Home. @@ -390,10 +385,11 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p moveWordLeft() case 'f': // Move word right. moveWordRight() - default: // Ignore Alt modifier for other keys. - if !add(event.Rune()) { - break - } + } + } else { + // Other keys are simply accepted as regular characters. + if !add(event.Rune()) { + break } } case tcell.KeyCtrlU: // Delete all.