tcl-tclreadline/tcl-tclreadline-2.1.0-synta...

44 lines
1.7 KiB
Diff

Patch by Sergei Golovan <sgolovan@debian.org> and Philip Quaife for tclreadline >= 2.1.0
which fixes a syntax error in completer (the bug arises if a command with options started
with a hyphen is completed) and fixes a bug with filenames completion for non-Tcl commands:
http://sourceforge.net/tracker/index.php?func=detail&aid=754797&group_id=7657&atid=107657
--- tclreadline-2.1.0/tclreadlineCompleter.tcl 2000-07-01 16:23:17.000000000 +0200
+++ tclreadline-2.1.0/tclreadlineCompleter.tcl.hyphen 2010-04-06 01:25:28.000000000 +0200
@@ -625,7 +625,7 @@
}
}
}
- if {![catch [list set type [image type ${cmd}]]]} {
+ if {![catch {list set type [image type ${cmd}]}]} {
switch -- ${type} {
photo {
set result [PhotoObj ${text} ${start} ${end} ${line} ${pos}]
@@ -1460,7 +1460,7 @@
# this can raise an error, if alias is
# no valid command.
#
- if {[catch [list set alias [namespace origin $alias]]]} {
+ if {[catch {set alias [namespace origin $alias]}]} {
return ""
}
@@ -3042,7 +3042,7 @@
proc complete(regsub) {text start end line pos mod} {
set prev [PreviousWord ${start} ${line}]
if {[llength ${prev}] && "--" != $prev && \
- ("-" == [string index ${prev} 0] || 1 == ${pos)}} {
+ ("-" == [string index ${prev} 0] || 1 == ${pos})} {
set cmds [RemoveUsedOptions ${line} {
-all -nocase --} {--}]
if {[llength ${cmds}]} {
@@ -3449,7 +3449,7 @@
proc complete(switch) {text start end line pos mod} {
set prev [PreviousWord ${start} ${line}]
if {[llength ${prev}] && "--" != ${prev} && \
- ("-" == [string index ${prev} 0] || 1 == ${pos)}} {
+ ("-" == [string index ${prev} 0] || 1 == ${pos})} {
set cmds [RemoveUsedOptions ${line} {
-exact -glob -regexp --} {--}]
if {[llength ${cmds}]} {