From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28054 invoked from network); 29 Jun 2000 09:27:18 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 29 Jun 2000 09:27:18 -0000 Received: (qmail 24480 invoked by alias); 29 Jun 2000 09:27:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12122 Received: (qmail 24473 invoked from network); 29 Jun 2000 09:27:13 -0000 Date: Thu, 29 Jun 2000 11:27:10 +0200 (MET DST) Message-Id: <200006290927.LAA29590@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Peter Stephenson's message of Thu, 29 Jun 2000 10:04:12 +0100 Subject: Re: PATCH: Re: (forw) --help able programs and completion] Peter Stephenson wrote: > Sven wrote > > I wrote: > > > > > [ the menu style and `yes=' ] > > > > > > Another question is if it should mean `if there are less than > > > matches, start menu completion', because menu completion (at least the > > > *real* menu completion, not selection) works best with few matches. > > I don't understand. I though Bart's original question was `how do I start > menu completion at a certain number of matches without menu selection?' > Now we have two ways for turning it off. Surely, if we're going to have > both, yes should mean `turn it on if at least n' and no should mean `turn > it off if at least n', so you can set a range? Ouch. Right. Ahem. > Unless you want to implement `yes=3' turn on at 3 `yes=-6' turn on to begin > with then off at 6 `yes=3-6' turn on from 3 to 6. I could get my brain > round that. Erm... hm, that's another idea (but if it's allowed for both yes and no rather irritating). Bye Sven Index: Completion/Core/_main_complete =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v retrieving revision 1.33 diff -u -r1.33 _main_complete --- Completion/Core/_main_complete 2000/06/29 07:04:17 1.33 +++ Completion/Core/_main_complete 2000/06/29 09:26:18 @@ -23,7 +23,7 @@ # Failed returns from this code are not real errors setopt localtraps noerrexit ; trap - ZERR -local func funcs ret=1 tmp _compskip format nm call match min i num\ +local func funcs ret=1 tmp _compskip format nm call match min max i num\ _completers _completer _completer_num curtag _comp_force_list \ _matchers _matcher _matcher_num _comp_tags _comp_mesg \ context state line opt_args val_args curcontext="$curcontext" \ @@ -181,7 +181,7 @@ sel=( "${(@M)_menu_style:#(yes|true|1|on)*}" ) if (( $#sel )); then - min=0 + min=9999999 for i in "$sel[@]"; do if [[ "$i" = *\=* ]]; then num="${i#*\=}" @@ -189,38 +189,36 @@ else num=$nm fi - [[ num -gt min ]] && min="$num" + [[ num -lt min ]] && min="$num" - [[ min -ge nm ]] && break + (( min )) || break done fi - if [[ ( -n "$min" && nm -le min ) || + sel=( "${(@M)_menu_style:#(no|false|0|off)*}" ) + + if (( $#sel )); then + max=9999999 + for i in "$sel[@]"; do + if [[ "$i" = *\=* ]]; then + num="${i#*\=}" + [[ num -lt 0 ]] && num=0 + else + num=0 + fi + [[ num -lt max ]] && max="$num" + + (( max )) || break + done + fi + if [[ ( -n "$min" && nm -ge min && ( -z "$max" || nm -lt max ) ) || ( -n "$_menu_style[(r)auto*]" && "$compstate[insert]" = automenu ) ]]; then compstate[insert]=menu + elif [[ -n "$max" && nm -ge max ]]; then + compstate[insert]=unambiguous elif [[ -n "$_menu_style[(r)auto*]" && "$compstate[insert]" != automenu ]]; then compstate[insert]=automenu-unambiguous - else - sel=( "${(@M)_menu_style:#(no|false|0|off)*}" ) - - if (( $#sel )); then - min=9999999 - for i in "$sel[@]"; do - if [[ "$i" = *\=* ]]; then - num="${i#*\=}" - [[ num -lt 0 ]] && num=0 - else - num=0 - fi - [[ num -lt min ]] && min="$num" - - (( min )) || break - done - else - min= - fi - [[ -n "$min" && nm -ge min ]] && compstate[insert]=unambiguous fi fi fi Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.79 diff -u -r1.79 compsys.yo --- Doc/Zsh/compsys.yo 2000/06/29 07:10:31 1.79 +++ Doc/Zsh/compsys.yo 2000/06/29 09:26:21 @@ -1595,7 +1595,7 @@ Using the form `tt(yes=)var(num)', where `tt(yes)' may be any of the true values (`tt(yes)', `tt(true)', `tt(on)' and `tt(1)') turns on -menu completion if there at most var(num) matches. Using this for one +menu completion if there at least var(num) matches. Using this for one of the `false' values (as in `tt(no=10)') makes menu completion em(not) be used if there are var(num) or more matches. Of course, this is only useful when menu completion is normally used, e.g. by -- Sven Wischnowsky wischnow@informatik.hu-berlin.de