diff options
author | patthoyts <patthoyts@noemail.net> | 2010-01-04 01:28:00 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@noemail.net> | 2010-01-04 01:28:00 (GMT) |
commit | 76c28d4caa05f3b6a7adb4895151b0d228446a73 (patch) | |
tree | 3221752d3b0ed1a01edbf1387d231a65ff453a0d /library/tk.tcl | |
parent | ff99615018fcc7a366c1f4255e32d7cfd720ed22 (diff) | |
download | tk-76c28d4caa05f3b6a7adb4895151b0d228446a73.zip tk-76c28d4caa05f3b6a7adb4895151b0d228446a73.tar.gz tk-76c28d4caa05f3b6a7adb4895151b0d228446a73.tar.bz2 |
Correctly handle quoted ampersands in AmpMenuArgs and friends
FossilOrigin-Name: 67ad2d0c1c73768ad71a5be01cdb230b21c80115
Diffstat (limited to 'library/tk.tcl')
-rw-r--r-- | library/tk.tcl | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/library/tk.tcl b/library/tk.tcl index d8f3c52..ef03cdb 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -3,7 +3,7 @@ # Initialization script normally executed in the interpreter for each Tk-based # application. Arranges class bindings for widgets. # -# RCS: @(#) $Id: tk.tcl,v 1.73.2.13 2009/12/11 11:12:27 dkf Exp $ +# RCS: @(#) $Id: tk.tcl,v 1.73.2.14 2010/01/04 01:28:01 patthoyts Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -471,25 +471,9 @@ proc ::tk::TabToWindow {w} { # ones. Position returned is -1 when there is no ampersand. # proc ::tk::UnderlineAmpersand {text} { - set idx [string first "&" $text] - if {$idx >= 0} { - set underline $idx - # ignore "&&" - while {[string match "&" [string index $text [expr {$idx + 1}]]]} { - set base [expr {$idx + 2}] - set idx [string first "&" [string range $text $base end]] - if {$idx < 0} { - break - } else { - set underline [expr {$underline + $idx + 1}] - incr idx $base - } - } - } - if {$idx >= 0} { - regsub -all -- {&([^&])} $text {\1} text - } - return [list $text $idx] + set s [string map {&& & & \ufeff} $text] + set idx [string first \ufeff $s] + return [list [string map {\ufeff {}} $s] $idx] } # ::tk::SetAmpText -- |