From 2082d99be34cba5e6e4ab14c85086739b3cc8688 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Wed, 27 Oct 1999 16:12:16 +0000 Subject: zsh-workers/8447 --- Functions/Zle/predict-on | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'Functions') diff --git a/Functions/Zle/predict-on b/Functions/Zle/predict-on index 159f723d4..839c8a1fd 100644 --- a/Functions/Zle/predict-on +++ b/Functions/Zle/predict-on @@ -31,20 +31,11 @@ predict-on() { 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 @@ insert-and-predict () { 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 @@ delete-no-predict() { # 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 -- cgit 1.4.1