From: "Oliver Kiddle" <okiddle@yahoo.co.uk>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@sunsite.dk
Subject: Re: ssh completion problem
Date: Fri, 8 Feb 2002 09:40:52 +0000 (GMT) [thread overview]
Message-ID: <20020208094052.89650.qmail@web9307.mail.yahoo.com> (raw)
In-Reply-To: <Pine.BSF.4.40.0202070142540.70914-100000@brasslantern.com>
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.
> > I think the patch below is the right fix - provided tmp can't be
>
> This doesn't work as I want. With the patch, the values from
users-hosts
> become the only possible matches, so I can't complete other
hostnames.
Ah sorry, testing $#tmp was basically wrong. The correct nasty hack
would be to use compadd -O thusly:
- compadd "$@" -a tmp || { (( $+functions[_$key] )) && "_$key" "$@" }
+ (( i=argv[(i)-F] ))
+ compadd -O all "${(@)argv[1,i]}" "${(@)argv[i+2,-1]}" -a tmp
+ if (( $#all )); then
+ compadd "$@" -a tmp
+ elif (( $+functions[_$key] )); then
+ "_$key" "$@"
+ fi
This is working around what I think is a fundamental problem with
nested tag loops where an outer loop splits tags into labels:
Suppose that an outer tag loop separately completes several labels for
a tag and that there is an inner tag loop for which there is a defined
tag-order. It can't then be known in the inner loop if matches are
added for a tag because it might be ignoring matches for a different
label which are added after it back-tracks to the outer tags loop and
then down to the inner loop with a new tag label. Without this
knowledge, the inner loop can't know whether to allow tags which appear
later in the tag-order to be completed.
Using a tags loop in _combination runs in to problems with this. The
following patch appears to work:
-local sep tag style keys pats key num tmp
+local sep tag style keys pats key num tmp expl i all ret=1
+ _my_accounts() {
+ _wanted hosts expl host compadd "$@" -a tmp
+ }
- compadd "$@" -a tmp || { (( $+functions[_$key] )) && "_$key" "$@" }
+ _tags "$tag" "not-$tag"
+ while _tags; do
+ (( $+functions[_$key] )) &&
+ _requested "not-$tag" expl 'ignore' "_$key" "$@" && ret=0
+ _requested "$tag" expl '' _my_accounts "$@" && ret=0
+ (( ret )) || break
+ done
More by luck than judgement however as looking up the tag-order with
the my-accounts tag is clearing _comp_ignore. The little _my_accounts
function is then needed so that we get one last _next_label loop to
separate the hosts out again.
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?
This is unrelated but out of interest, why is the _next_labels stage
skipped in some completion functions?
Oliver
__________________________________________________
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
next prev parent reply other threads:[~2002-02-08 9:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1020205170847.ZM29675@candle.brasslantern.com>
2002-02-06 9:00 ` Oliver Kiddle
2002-02-07 1:54 ` Bart Schaefer
2002-02-08 9:40 ` Oliver Kiddle [this message]
2002-02-08 18:26 ` Bart Schaefer
2002-02-11 9:12 ` Sven Wischnowsky
2002-02-11 18:04 ` Bart Schaefer
2002-02-12 9:18 ` Oliver Kiddle
2002-02-12 13:16 ` Sven Wischnowsky
2002-02-12 15:08 ` Oliver Kiddle
2002-02-12 15:20 ` Sven Wischnowsky
2002-02-15 17:15 ` Oliver Kiddle
2002-02-18 14:28 ` Sven Wischnowsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020208094052.89650.qmail@web9307.mail.yahoo.com \
--to=okiddle@yahoo.co.uk \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).