zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>,
	zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: predict-on: suppress long listings
Date: Wed, 27 Oct 1999 16:10:12 +0000	[thread overview]
Message-ID: <991027161012.ZM3647@candle.brasslantern.com> (raw)
In-Reply-To: <199910271403.QAA16743@beta.informatik.hu-berlin.de>

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


  parent reply	other threads:[~1999-10-27 16:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-27 14:03 Sven Wischnowsky
1999-10-27 15:51 ` Bart Schaefer
1999-10-27 16:10 ` Bart Schaefer [this message]
1999-10-27 16:15 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
1999-11-03  8:11 Sven Wischnowsky
1999-10-28  8:03 Sven Wischnowsky
1999-11-02 19:05 ` Bart Schaefer
1999-10-26 16:08 Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=991027161012.ZM3647@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).