2
0
mirror of https://github.com/rivo/tview.git synced 2024-11-15 06:12:46 +00:00

Merge pull request #186 from ravenops/fix/185

Fixes #185
This commit is contained in:
rivo 2018-11-19 10:50:12 +01:00 committed by GitHub
commit 0612ff69bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -364,8 +364,8 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p
// accepted. // accepted.
add := func(r rune) bool { add := func(r rune) bool {
newText := i.text[:i.cursorPos] + string(r) + i.text[i.cursorPos:] newText := i.text[:i.cursorPos] + string(r) + i.text[i.cursorPos:]
if i.accept != nil { if i.accept != nil && !i.accept(newText, r) {
return i.accept(newText, r) return false
} }
i.text = newText i.text = newText
i.cursorPos += len(string(r)) i.cursorPos += len(string(r))