summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-05-03 14:28:34 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-05-03 14:28:34 (GMT)
commitde6db8c03eed86af2bd00514dc4da5c321a822ab (patch)
treedc7d6ac9ba549a3e6e7d3125698e2e8433165ab7 /library
parentbd2452b05ad18d7a755643a1608882eee9f37023 (diff)
downloadtcl-de6db8c03eed86af2bd00514dc4da5c321a822ab.zip
tcl-de6db8c03eed86af2bd00514dc4da5c321a822ab.tar.gz
tcl-de6db8c03eed86af2bd00514dc4da5c321a822ab.tar.bz2
* library/init.tcl: Corrected unique prefix matching of
interactive command completion in [unknown]. [Bug 946952]
Diffstat (limited to 'library')
-rw-r--r--library/init.tcl15
1 files changed, 12 insertions, 3 deletions
diff --git a/library/init.tcl b/library/init.tcl
index e645ac9..de2f8c6 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.60 2004/03/17 18:14:14 das Exp $
+# RCS: @(#) $Id: init.tcl,v 1.61 2004/05/03 14:28:35 dgp Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -293,13 +293,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]]