From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15368 invoked from network); 28 Jun 2000 14:26:04 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 28 Jun 2000 14:26:04 -0000 Received: (qmail 19352 invoked by alias); 28 Jun 2000 14:25:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12109 Received: (qmail 19345 invoked from network); 28 Jun 2000 14:25:43 -0000 Date: Wed, 28 Jun 2000 16:25:35 +0200 (MET DST) Message-Id: <200006281425.QAA03225@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Wed, 28 Jun 2000 18:07:49 +0400 Subject: PATCH: Re: Confused with verbose output and context names 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