Fix regression where cursor was misplaced after a paste

This commit is contained in:
Christian Rocha 2020-10-24 18:17:59 -04:00 committed by Christian Rocha
parent 03461d6804
commit 703de11da4

View File

@ -175,7 +175,7 @@ func (m *Model) Paste() {
// Insert pasted runes // Insert pasted runes
for _, r := range paste { for _, r := range paste {
head = append(head, r) head = append(head, r)
m.SetCursor(m.pos + 1) m.pos++
if m.CharLimit > 0 { if m.CharLimit > 0 {
availSpace-- availSpace--
if availSpace <= 0 { if availSpace <= 0 {
@ -186,6 +186,9 @@ func (m *Model) Paste() {
// Put it all back together // Put it all back together
m.value = append(head, tail...) 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 // If a max width is defined, perform some logic to treat the visible area