diff options
-rw-r--r-- | generic/tkText.c | 5 | ||||
-rw-r--r-- | generic/tkText.h | 2 | ||||
-rw-r--r-- | tests/text.test | 14 |
3 files changed, 17 insertions, 4 deletions
diff --git a/generic/tkText.c b/generic/tkText.c index 4195238..6b90a23 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -2774,7 +2774,6 @@ TextPushUndoAction( { TkUndoSubAtom *iAtom, *dAtom; int canUndo, canRedo; - static int undoMarkId = -1; char lMarkName[20] = "tk::undoMarkL"; char rMarkName[20] = "tk::undoMarkR"; char stringUndoMarkId[7] = ""; @@ -2848,8 +2847,8 @@ TextPushUndoAction( Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, Tcl_NewStringObj("set", 3)); markSetRUndoMarkCmdObj = Tcl_DuplicateObj(markSetLUndoMarkCmdObj); - undoMarkId++; - sprintf(stringUndoMarkId, "%d", undoMarkId); + textPtr->sharedTextPtr->undoMarkId++; + sprintf(stringUndoMarkId, "%d", textPtr->sharedTextPtr->undoMarkId); strcat(lMarkName, stringUndoMarkId); strcat(rMarkName, stringUndoMarkId); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, diff --git a/generic/tkText.h b/generic/tkText.h index 5d88784..430c96b 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -580,6 +580,8 @@ typedef struct TkSharedText { * statements. */ int autoSeparators; /* Non-zero means the separators will be * inserted automatically. */ + int undoMarkId; /* Counts undo marks temporarily used during + undo and redo operations. */ int isDirty; /* Flag indicating the 'dirtyness' of the * text widget. If the flag is not zero, * unsaved modifications have been applied to diff --git a/tests/text.test b/tests/text.test index 2e4177d..1a68239 100644 --- a/tests/text.test +++ b/tests/text.test @@ -1458,7 +1458,19 @@ Line 7" rename .t {} rename test.t .t destroy .t -} -result {{edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} {insert 2.1 ef} {mark set insert 2.3} {see insert}} +} -result [list {edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} \ + {mark set tk::undoMarkL3 2.1} {mark set tk::undoMarkR3 2.4} \ + {mark gravity tk::undoMarkL3 left} {mark gravity tk::undoMarkR3 right} \ + {insert 2.1 ef} {mark set insert 2.3} {see insert} \ + {mark set tk::undoMarkL2 2.1} {mark set tk::undoMarkR2 2.3} \ + {mark gravity tk::undoMarkL2 left} {mark gravity tk::undoMarkR2 right} \ + {mark names} \ + {index tk::undoMarkL2} {index tk::undoMarkR2} \ + {mark unset tk::undoMarkL2 tk::undoMarkR2} \ + {index tk::undoMarkL3} {index tk::undoMarkR3} \ + {mark unset tk::undoMarkL3 tk::undoMarkR3} \ + {compare 2.1 > 2.3} {compare 2.6 > 2.3} ] + test text-8.23 {TextWidgetCmd procedure, "replace" option with undo} -setup { text .t } -body { |