diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2010-01-04 01:36:14 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2010-01-04 01:36:14 (GMT) |
commit | 1123a820260423a4987437280a9f6ec6ae123839 (patch) | |
tree | f577a40eb56f26b341d134cd5125b10c37c78e18 | |
parent | 9fe9acb5db618af04b2a93617a9c4a16091d24be (diff) | |
download | tk-1123a820260423a4987437280a9f6ec6ae123839.zip tk-1123a820260423a4987437280a9f6ec6ae123839.tar.gz tk-1123a820260423a4987437280a9f6ec6ae123839.tar.bz2 |
Correctly handle quoted ampersands in AmpMenuArgs and friends
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | library/tk.tcl | 23 |
2 files changed, 8 insertions, 19 deletions
@@ -1,3 +1,7 @@ +2010-01-04 Pat Thoyts <patthoyts@users.sourceforge.net> + + * library/tk.tcl: Correctly handle quoted ampersands in AmpMenuArgs + 2010-01-03 Donal K. Fellows <dkf@users.sf.net> * unix/tcl.m4 (SC_CONFIG_CFLAGS): [Bug 1636685]: Use the configuration diff --git a/library/tk.tcl b/library/tk.tcl index e950c24..d80feb0 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.88 2009/12/11 15:32:36 dkf Exp $ +# RCS: @(#) $Id: tk.tcl,v 1.89 2010/01/04 01:36:14 patthoyts Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -485,24 +485,9 @@ proc ::tk::TabToWindow {w} { # 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 - } - 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 -- |