diff options
author | dgp <dgp@users.sourceforge.net> | 2004-05-03 14:28:59 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-05-03 14:28:59 (GMT) |
commit | 9326437245bec03c6f439aa79c3c9db762056d16 (patch) | |
tree | 56355d3299f9b28d3cc035873edd2a523fae78b6 /library/init.tcl | |
parent | 0ecdf938ca2b533273751a770d7c794e89faa9d3 (diff) | |
download | tcl-9326437245bec03c6f439aa79c3c9db762056d16.zip tcl-9326437245bec03c6f439aa79c3c9db762056d16.tar.gz tcl-9326437245bec03c6f439aa79c3c9db762056d16.tar.bz2 |
* library/init.tcl: Corrected unique prefix matching of
interactive command completion in [unknown]. [Bug 946952]
Diffstat (limited to 'library/init.tcl')
-rw-r--r-- | library/init.tcl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/library/init.tcl b/library/init.tcl index b1d2b09..b669d6a 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -3,7 +3,7 @@ # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # -# RCS: @(#) $Id: init.tcl,v 1.55.2.2 2003/09/23 04:49:12 dgp Exp $ +# RCS: @(#) $Id: init.tcl,v 1.55.2.3 2004/05/03 14:28:59 dgp Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -295,13 +295,22 @@ proc unknown args { return [uplevel 1 $newcmd] } - set ret [catch {set cmds [info commands $name*]} msg] + set ret [catch {set candidates [info commands $name*]} msg] if {[string equal $name "::"]} { set name "" } if {$ret != 0} { return -code $ret -errorcode $errorCode \ - "error in unknown while checking if \"$name\" is a unique command abbreviation: $msg" + "error in unknown while checking if \"$name\" is\ + a unique command abbreviation:\n$msg" + } + # Filter out bogus matches when $name contained + # a glob-special char [Bug 946952] + set cmds [list] + foreach x $candidates { + if {[string range $x 0 [expr [string length $name]-1]] eq $name} { + lappend cmds $x + } } if {[llength $cmds] == 1} { return [uplevel 1 [lreplace $args 0 0 $cmds]] |