From ba5edbc89b36520b759a88fb1dc6d06b7f1c0e8a Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 4 Mar 2023 15:22:47 +0000 Subject: Fix [93fe36b5a7]: <> virtual event not working for menus with -tearoff option --- library/tearoff.tcl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/library/tearoff.tcl b/library/tearoff.tcl index 96e275f..24168cb 100644 --- a/library/tearoff.tcl +++ b/library/tearoff.tcl @@ -154,9 +154,7 @@ proc ::tk::MenuDup {src dst type} { # Copy tags to x, replacing each substring of src with dst. while {[set index [string first $src $tags]] >= 0} { - if {$index > 0} { - append x [string range $tags 0 $index-1]$dst - } + append x [string range $tags 0 $index-1]$dst set tags [string range $tags $index+$srcLen end] } append x $tags @@ -171,9 +169,7 @@ proc ::tk::MenuDup {src dst type} { # Copy script to x, replacing each substring of event with dst. while {[set index [string first $event $script]] >= 0} { - if {$index > 0} { - append x [string range $script 0 $index-1] - } + append x [string range $script 0 $index-1] append x $dst set script [string range $script $index+$eventLen end] } -- cgit v0.12