From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: Confused with verbose output and context names
Date: Wed, 28 Jun 2000 16:25:35 +0200 (MET DST) [thread overview]
Message-ID: <200006281425.QAA03225@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Wed, 28 Jun 2000 18:07:49 +0400
Andrej Borsenkow wrote:
> bor@itsrm2% gdiff -I TAB
> bor@itsrm2% gdiff -I
> Completing line exclusion regex
> Completing `line exclusion regex'
>
> Why do I get output twice?
Murks in _complete. It didn't use the return value, but tested
$compstate[nmatches], so it called it for every match spec, then
returned non-zero even though the message was added and _main_complete
called other completers and before that reset the flag that says that
a message was added so that you got the message and the `warning' that
there are no matches (the line with the `...').
> bor@itsrm2% gdiff -I ^Xh
> Completing line exclusion regex
> tags in context :completion::complete:gdiff::
> option-I-1 (_arguments _diff_options _diff)
> tags in context :completion::complete:gdiff:option-I-1:
> messages (_message _arguments _diff_options _diff)
>
> Very interesting is the first context - where does it come from? We are
> completing the first argument of -I option ... confused
As it says: _arguments, which has to find out if you want to complete
options or only arguments or whatever.
Bye
Sven
Index: Completion/Core/_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_complete,v
retrieving revision 1.4
diff -u -r1.4 _complete
--- Completion/Core/_complete 2000/05/15 13:19:26 1.4
+++ Completion/Core/_complete 2000/06/28 14:21:49
@@ -4,7 +4,7 @@
# a normal completion function, but as one possible value for the
# completer style.
-local comp name oldcontext
+local comp name oldcontext ret=1
typeset -T curcontext="$curcontext" ccarray
oldcontext="$curcontext"
@@ -25,11 +25,10 @@
comp="$_comps[-first-]"
if [[ ! -z "$comp" ]]; then
ccarray[3]=-first-
- "$comp"
+ "$comp" && ret=0
if [[ "$_compskip" = all ]]; then
- _compskip=''
- (( compstate[nmatches] ))
- return
+ _compskip=
+ return ret
fi
fi
@@ -42,7 +41,7 @@
if [[ "$compstate[context]" = command ]]; then
curcontext="$oldcontext"
- _normal -s
+ _normal -s && ret=0
else
# Let's see if we have a special completion definition for the other
# possible contexts.
@@ -57,14 +56,14 @@
if [[ -z "$comp" ]]; then
if [[ "$_compskip" = *default* ]]; then
- _compskip=''
+ _compskip=
return 1
fi
comp="$_comps[-default-]"
fi
- [[ -z "$comp" ]] || "$comp"
+ [[ -z "$comp" ]] || "$comp" && ret=0
fi
-_compskip=''
+_compskip=
-(( compstate[nmatches] ))
+return ret
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
reply other threads:[~2000-06-28 14:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200006281425.QAA03225@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.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).