Merge pull request #857 from JoseRizzal/textarea__fix_nextUndo_after_SetText

Closes #844  Fix TextArea's SetText by resetting nextUndo counter
This commit is contained in:
rivo 2023-06-15 10:54:08 +02:00 committed by GitHub
commit bb9595ee0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -385,6 +385,7 @@ func (t *TextArea) SetText(text string, cursorAtTheEnd bool) *TextArea {
t.cursor.row, t.cursor.actualColumn, t.cursor.column = 0, 0, 0 t.cursor.row, t.cursor.actualColumn, t.cursor.column = 0, 0, 0
t.cursor.pos = [3]int{1, 0, -1} t.cursor.pos = [3]int{1, 0, -1}
t.undoStack = t.undoStack[:0] t.undoStack = t.undoStack[:0]
t.nextUndo = 0
if len(text) > 0 { if len(text) > 0 {
t.spans = append(t.spans, textAreaSpan{ t.spans = append(t.spans, textAreaSpan{