Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ssh completion problem



[ moved to -workers ]

Bart wrote:

> when I complete after `lll@' I get offered all possible hosts from
the
> `hosts' style.  I want to be offered only `bbb.com' in that case.
> 
> (When I complete after just `l', it completes to `lll', then waits
for
> another tab.)
> 
> The problem is somehow related to this additional style:
> 
>       tag-order my-accounts \
>        'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'

I think the problem is due to this line in _combination:

compadd "$@" -a tmp || { (( $+functions[_$key] )) && "_$key" "$@" }

The line gets run for each of host hosts, domains and IP addresses.
Only one needs to fail for "_$key" (_hosts in effect) to go on to run.
This is quite possible as "$@" expands to, amoung other things, `-F
_comp_ignore'. I think the patch below is the right fix - provided tmp
can't be different with each of the tags.

We do compadd <something> || compadd <something else> in other parts of
the completion system so they may also be afflicted. As I think I've
mentioned previously, a way of specifying a default tag-order would be
better.

Oliver

--- Completion/Base/Utility/_combination      Mon Apr  2 12:10:08 2001
+++ Completion/Base/Utility/_combination      Wed Feb  6 03:21:32 2002
@@ -88,7 +88,11 @@
   fi
   tmp=( ${tmp%%${~sep}*} )
 
-  compadd "$@" -a tmp || { (( $+functions[_$key] )) && "_$key" "$@" }
+  if (( $#tmp )); then
+    compadd "$@" -a tmp 
+  elif (( $+functions[_$key] )); then
+    "_$key" "$@"
+  fi
 else
   (( $+functions[_$key] )) && "_$key" "$@"
 fi


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com



Messages sorted by: Reverse Date, Date, Thread, Author