summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-07-07 06:39:26 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-07-07 06:39:26 (GMT)
commit1052e56fe96f3ece407a6374714af0302c9a5e3c (patch)
treebaba04a4a70091dfb5992d6621af3a3ab51bdeca /library
parentbf98687ae68fe39f9b67d9cd3c1553bfdd43bf7b (diff)
downloadtk-1052e56fe96f3ece407a6374714af0302c9a5e3c.zip
tk-1052e56fe96f3ece407a6374714af0302c9a5e3c.tar.gz
tk-1052e56fe96f3ece407a6374714af0302c9a5e3c.tar.bz2
Added comments justifying why we can rely on finding all the needed marks still in the text widget at the time they are transformed into indices.
Diffstat (limited to 'library')
-rw-r--r--library/text.tcl13
1 files changed, 13 insertions, 0 deletions
diff --git a/library/text.tcl b/library/text.tcl
index f241abd..02a8939 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -1228,6 +1228,19 @@ proc ::tk::TextUndoRedoProcessMarks {w} {
# transform marks into indices
# the number of undo/redo marks is always even, each right mark
# completes a left mark to give a range
+ # this is true because:
+ # - undo/redo only deals with insertions and deletions of text
+ # - insertions may move marks but not delete them
+ # - when deleting text, marks located inside the deleted range
+ # are not erased but moved to the start of the deletion range
+ # . this is done in TkBTreeDeleteIndexRange ("This segment
+ # refuses to die...")
+ # . because MarkDeleteProc does nothing else than returning
+ # a value indicating that marks are not deleted by this
+ # deleteProc
+ # . mark deletion rather happen through [.text mark unset xxx]
+ # which was not used _up to this point of the code_ (it
+ # is a bit later just before exiting the present proc)
set nUndoMarks [llength $undoMarks]
set n [expr {$nUndoMarks / 2}]
set undoMarks [lsort -dictionary $undoMarks]