* PATCH: Re: Confused with verbose output and context names
@ 2000-06-28 14:25 Sven Wischnowsky
0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 2000-06-28 14:25 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-06-28 14:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-28 14:25 PATCH: Re: Confused with verbose output and context names Sven Wischnowsky
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).