1
0
mirror of https://github.com/rivo/tview.git synced 2025-04-24 13:48:56 +08:00

fix per @jr81

This commit is contained in:
Delaney Gillilan 2018-11-18 13:15:59 -08:00
parent 8cf347b745
commit a38d2cdc9b

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))