summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-07 07:36:54 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-07 07:36:54 (GMT)
commite98aae4fa3764318f9d15a11334ecd8c3136e455 (patch)
tree2b4286bbcb7ff7b0e7609e465acffabcc9e33d0e /library
parent4c84488a48ea2a3d1791f71ddb1e132e986d0770 (diff)
parent75cef68e71289b2afd2a5e128d734dd2f99f0496 (diff)
downloadtk-e98aae4fa3764318f9d15a11334ecd8c3136e455.zip
tk-e98aae4fa3764318f9d15a11334ecd8c3136e455.tar.gz
tk-e98aae4fa3764318f9d15a11334ecd8c3136e455.tar.bz2
Merge trunk
Diffstat (limited to 'library')
-rw-r--r--library/tearoff.tcl8
-rw-r--r--library/text.tcl6
2 files changed, 11 insertions, 3 deletions
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index b500023..c2d2d6b 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -154,7 +154,9 @@ proc ::tk::MenuDup {src dst type} {
# Copy tags to x, replacing each substring of src with dst.
while {[set index [string first $src $tags]] != -1} {
- append x [string range $tags 0 [expr {$index - 1}]]$dst
+ if {$index > 0} {
+ append x [string range $tags 0 [expr {$index - 1}]]$dst
+ }
set tags [string range $tags [expr {$index + $srcLen}] end]
}
append x $tags
@@ -169,7 +171,9 @@ proc ::tk::MenuDup {src dst type} {
# Copy script to x, replacing each substring of event with dst.
while {[set index [string first $event $script]] != -1} {
- append x [string range $script 0 [expr {$index - 1}]]
+ if {$index > 0} {
+ append x [string range $script 0 [expr {$index - 1}]]
+ }
append x $dst
set script [string range $script [expr {$index + $eventLen}] end]
}
diff --git a/library/text.tcl b/library/text.tcl
index 62db560..6d3df8e 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -1278,7 +1278,11 @@ proc ::tk::TextUndoRedoProcessMarks {w} {
set nUndoMarks [llength $undoMarks]
set n [expr {$nUndoMarks / 2}]
set undoMarks [lsort -dictionary $undoMarks]
- set Lmarks [lrange $undoMarks 0 [expr {$n - 1}]]
+ if {$n > 0} {
+ set Lmarks [lrange $undoMarks 0 [expr {$n - 1}]]
+ } else {
+ set Lmarks {}
+ }
set Rmarks [lrange $undoMarks $n [llength $undoMarks]]
foreach Lmark $Lmarks Rmark $Rmarks {
lappend indices [$w index $Lmark] [$w index $Rmark]