summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--library/init.tcl15
2 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index af3f478..47bf86f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-03 Don Porter <dgp@users.sourceforge.net>
+
+ * library/init.tcl: Corrected unique prefix matching of
+ interactive command completion in [unknown]. [Bug 946952]
+
2004-05-02 Miguel Sofer <msofer@users.sf.net>
* generic/tclProc.c (TclObjInvokeProc):
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]]