Skip to content

Commit

Permalink
Fix [ab839efc5f]: text edit undo: clearing text instead of restoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
fvogelnew1 committed Apr 21, 2024
2 parents 27db51f + 5f0874e commit 6ea395a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions generic/tkText.c
Original file line number Diff line number Diff line change
Expand Up @@ -5059,6 +5059,10 @@ TextEditUndo(
return TCL_OK;
}

if (textPtr->sharedTextPtr->autoSeparators) {
TkUndoInsertUndoSeparator(textPtr->sharedTextPtr->undoStack);
}

/*
* Turn off the undo feature while we revert a compound action, setting
* the dirty handling mode to undo for the duration (unless it is
Expand All @@ -5077,6 +5081,10 @@ TextEditUndo(
}
textPtr->sharedTextPtr->undo = 1;

if (textPtr->sharedTextPtr->autoSeparators) {
TkUndoInsertUndoSeparator(textPtr->sharedTextPtr->undoStack);
}

return status;
}

Expand Down
15 changes: 15 additions & 0 deletions tests/text.test
Original file line number Diff line number Diff line change
Expand Up @@ -6967,6 +6967,21 @@ test text-27.25 {<<UndoStack>> virtual event} -setup {
} -cleanup {
destroy .t
} -result {0 0 1 2 3 4 4 5 6 6 7 8 8 9}
test text-27.26 {bug ab839efc5f - .text edit undo inserts separators} -setup {
destroy .t
} -body {
text .t -undo 1
.t insert 1.0 "1. 123 5 789012 LINE-1\n2.\n3. 123 5 789012 LINE-3\n"
.t tag add sel 3.0 3.end
.t delete sel.first sel.last
.t edit undo
.t tag add sel 3.0 3.end
.t delete sel.first sel.last
.t edit undo
.t get 3.0 3.end
} -cleanup {
destroy .t
} -result {3. 123 5 789012 LINE-3}


test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body {
Expand Down

0 comments on commit 6ea395a

Please sign in to comment.