summaryrefslogtreecommitdiffstats
path: root/Functions
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-10-27 16:12:16 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-10-27 16:12:16 +0000
commit2082d99be34cba5e6e4ab14c85086739b3cc8688 (patch)
tree0ff05515aac2ea526019db4fc81b749ae8ef6963 /Functions
parentzsh-workers/8442 (diff)
downloadzsh-2082d99be34cba5e6e4ab14c85086739b3cc8688.tar
zsh-2082d99be34cba5e6e4ab14c85086739b3cc8688.tar.gz
zsh-2082d99be34cba5e6e4ab14c85086739b3cc8688.tar.bz2
zsh-2082d99be34cba5e6e4ab14c85086739b3cc8688.tar.lz
zsh-2082d99be34cba5e6e4ab14c85086739b3cc8688.tar.xz
zsh-2082d99be34cba5e6e4ab14c85086739b3cc8688.tar.zst
zsh-2082d99be34cba5e6e4ab14c85086739b3cc8688.zip
zsh-workers/8447
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Zle/predict-on17
1 files changed, 6 insertions, 11 deletions
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