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

Re: ssh completion problem

 --- Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

> I tried this patch, and it doesn't seem to help.  That is, if I have
> tag-order style, I get the same behavior as the old _combination: it
> completes the user part of the users-hosts from my-accounts, but then
> offers all possible hosts as completions for what comes after the @.
> Is there something else I should be doing, or was that patch not
> meant to solve my problem?

Did you try the first patch? The second patch was there because it
demonstrates why I think this problem is more fundamental than just
_combination. If you just want to get this working, Sven's patch is
now perhaps a better bet as I see you've now done. Needing two tabs
is a separate issue which has come up before. A possible solution
to that might be some value in compstate which if set causes
completion to have another go if a first match was unambiguously
added. It'll be more complicated if l@b is to complete to lll@xxxxxxx

Sven Wischnowsky <wischnow@xxxxxxxxx> wrote:

> > I can't reproduce that.
> You need to set some ignored-patterns styles to split into host,
> host-with-domain and ip-address.

I did have ignored-patterns styles set - '*.*' (host), '^[^0-9]*.*'
(domain) and '^[0-9.]#' (ipaddr). Perhaps Bart's use of different
patterns was significant though.

> 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.

Where is the right place to add default matches then? Having a way to
specify a default tag-order would seem the most logical to me.

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

With this there is then two loops for the hosts tag. The inner loop
allows it to loop over the three labels again so it knows if matches
are added for each label or not. Note that there are then nine calls to
compadd. It only works because the final (innermost) label loop is for
the same tag that is separated into labels. I still am convinced that
there is a wider problem which this doesn't solve. The second patch
in my last post is a useful one for seeing the problems.

> > This is unrelated but out of interest, why is the _next_labels
> > skipped in some completion functions?
> Could you give me an example, so that I don't need to search?

_netscape. There's also a few cases which look like `_requested users
&& _users && ret=0' but I suppose they're okay because of _users
calling _wanted? 


Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

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