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

Re: ssh completion problem



Oliver Kiddle wrote:

> Bart wrote:
> > 
> > Right again, so far ... however, in looking at my own _complete_debug
> > output *before* applying your patch, the odd thing is that the first
> > compadd is failing for no apparent reason.  That is, for completion
> after
> > `lll@', it does `tmp=(bbb.com)' and `compadd -F _comp_ignore -a tmp',
> > but even though bbb.com is not ignored, still the compadd returns 1.
> 
> I can't reproduce that.

You need to set some ignored-patterns styles to split into host,
host-with-domain and ip-address.

> ...
> 
> Only dividing tags into labels before compadds might be a way to
> solve this. I need to investigate further because I don't fully
> understand how tags and labels work. I may have badly misunderstood
> things so far. Sven?

Your analysis is basically right, the problem is that _combination
doesn't know whether there might be other matches be added for the tag
by an outer loop. So I think what is wrong here is _combination adding
default matches. I'd think that's simlpy the wrong place to do that.

One way to circumvent most problems with tag and label loops is to
make _combination loop:

--- Completion/Base/Utility/_combination	Mon Apr  2 13:10:08 2001
+++ _combination	Mon Feb 11 09:38:06 2002
@@ -88,7 +88,9 @@
   fi
   tmp=( ${tmp%%${~sep}*} )
 
-  compadd "$@" -a tmp || { (( $+functions[_$key] )) && "_$key" "$@" }
+  local expl
+  _wanted $key expl $key  compadd "$@" -a tmp ||
+      { (( $+functions[_$key] )) && "_$key" "$@" }
 else
   (( $+functions[_$key] )) && "_$key" "$@"
 fi


This patch can't be complete, though (only something to play with and
then decide if we want to go this way), because to make this right we
need to pass _combination a description.

> This is unrelated but out of interest, why is the _next_labels stage
> skipped in some completion functions?

Could you ive me an example, so that I don't need to search?


Bye
  Sven

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



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