From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26310 invoked from network); 27 Oct 1999 16:11:11 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Oct 1999 16:11:11 -0000 Received: (qmail 621 invoked by alias); 27 Oct 1999 16:11:02 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8447 Received: (qmail 614 invoked from network); 27 Oct 1999 16:11:01 -0000 From: "Bart Schaefer" Message-Id: <991027161012.ZM3647@candle.brasslantern.com> Date: Wed, 27 Oct 1999 16:10:12 +0000 In-Reply-To: <199910271403.QAA16743@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: PATCH: predict-on: suppress long listings" (Oct 27, 4:03pm) References: <199910271403.QAA16743@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (5.0.0 30July97) To: Sven Wischnowsky , zsh-workers@sunsite.auc.dk Subject: Re: PATCH: predict-on: suppress long listings MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 27, 4:03pm, Sven Wischnowsky wrote: } Subject: Re: PATCH: predict-on: suppress long listings } } The last key, `predict_list', is probably not needed, but with the } usual behavior of showing a list below the command line, I find it } somewhat irritating when it suddenly stops doing so only because we } have reached the state where only one match is left. Actually, to prevent the "do you wish" prompt we should check list_max as well. And here's the automenu change. Index: Functions/Zle/predict-on =================================================================== @@ -31,20 +31,11 @@ zle -N magic-space insert-and-predict zle -N backward-delete-char delete-backward-and-predict zle -N delete-char-or-list delete-no-predict - - # Prediction doesn't work well with automenu set, so we unset it here - # and restore it in predict-off(). - if [[ -o automenu ]]; then - unsetopt automenu - _predict_am=yes - fi } predict-off() { zle -A .self-insert self-insert zle -A .magic-space magic-space zle -A .backward-delete-char backward-delete-char - - [[ -n $_predict_am ]] && setopt automenu } insert-and-predict () { emulate -L zsh @@ -61,6 +52,7 @@ RBUFFER="" if [[ ${KEYS[-1]} != ' ' ]] then + unsetopt automenu integer curs=$CURSOR pos nchar=${#LBUFFER//[^${KEYS[-1]}]} local -a +h comppostfuncs comppostfuncs=( predict-limit-list ) @@ -120,11 +112,14 @@ # of matches from forcing a "do you wish to see all ...?" prompt. predict-limit-list() { - if [[ compstate[list_lines]+BUFFERLINES -gt LINES ]]; then + if (( compstate[list_lines]+BUFFERLINES > LINES || + compstate[nmatches] > compstate[list_max] )) + then compstate[list]='' compstate[force_list]=yes + elif [[ $compconfig[predict_list] = always ]] + compstate[force_list]=yes fi - [[ $compconfig[predict_list] = always ]] && compstate[force_list]=yes } # Handle zsh autoloading conventions -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com