diff --git a/generic/tkText.c b/generic/tkText.c index b3ce207c2..23e0647fa 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -5115,6 +5115,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 @@ -5133,6 +5137,10 @@ TextEditUndo( } textPtr->sharedTextPtr->undo = 1; + if (textPtr->sharedTextPtr->autoSeparators) { + TkUndoInsertUndoSeparator(textPtr->sharedTextPtr->undoStack); + } + /* * Convert undo/redo temporary marks set by TkUndoRevert() into * indices left in the interp result. diff --git a/tests/text.test b/tests/text.test index 5f574c018..230372911 100644 --- a/tests/text.test +++ b/tests/text.test @@ -7039,7 +7039,21 @@ test text-27.28 {edit undo and edit redo do not leave \ } -cleanup { destroy .t } -result {1 1} - +test text-27.29 {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 { pack [text .t -wrap none]