Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: Confused with verbose output and context names
- X-seq: zsh-workers 12109
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: Re: Confused with verbose output and context names
- Date: Wed, 28 Jun 2000 16:25:35 +0200 (MET DST)
- In-reply-to: "Andrej Borsenkow"'s message of Wed, 28 Jun 2000 18:07:49 +0400
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author