From 703de11da488b2d1f0bee8a0e9bc18e6a424d05b Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Sat, 24 Oct 2020 18:17:59 -0400 Subject: [PATCH] Fix regression where cursor was misplaced after a paste --- textinput/textinput.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/textinput/textinput.go b/textinput/textinput.go index 201e8ef..ea773c0 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -175,7 +175,7 @@ func (m *Model) Paste() { // Insert pasted runes for _, r := range paste { head = append(head, r) - m.SetCursor(m.pos + 1) + m.pos++ if m.CharLimit > 0 { availSpace-- if availSpace <= 0 { @@ -186,6 +186,9 @@ func (m *Model) Paste() { // Put it all back together m.value = append(head, tail...) + + // Reset blink state and run overflow checks + m.SetCursor(m.pos) } // If a max width is defined, perform some logic to treat the visible area