diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-10-26 16:17:30 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-10-26 16:17:30 +0000 |
commit | 270b48432de9ef8f17e97695576ccaf426d7e9c5 (patch) | |
tree | 87884cb55e438ca05736385bce5293172d136fdb | |
parent | e0b26186f1d3c1a3a580eb7e8a8199c25536f4e6 (diff) | |
download | zsh-270b48432de9ef8f17e97695576ccaf426d7e9c5.tar.gz zsh-270b48432de9ef8f17e97695576ccaf426d7e9c5.tar.xz zsh-270b48432de9ef8f17e97695576ccaf426d7e9c5.zip |
zsh-workers/8428
-rw-r--r-- | Functions/Zle/predict-on | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Functions/Zle/predict-on b/Functions/Zle/predict-on index dbd828975..db129e45c 100644 --- a/Functions/Zle/predict-on +++ b/Functions/Zle/predict-on @@ -25,14 +25,12 @@ # error message. predict-on() { - setopt localoptions unset noksharrays zle -N self-insert insert-and-predict 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 } predict-off() { - setopt localoptions unset noksharrays zle -A .self-insert self-insert zle -A .magic-space magic-space zle -A .backward-delete-char backward-delete-char @@ -53,6 +51,8 @@ insert-and-predict () { if [[ ${KEYS[-1]} != ' ' ]] then integer curs=$CURSOR + local -a +h comppostfuncs + comppostfuncs=( predict-limit-list ) zle complete-word CURSOR=$curs fi @@ -79,8 +79,20 @@ delete-backward-and-predict() { fi } delete-no-predict() { - predict-off + [[ $WIDGET != delete-char-or-list || -n $RBUFFER ]] && predict-off zle .$WIDGET "$@" } +# This is a helper function for autocompletion to prevent long lists +# of matches from forcing a "do you wish to see all ...?" prompt. + +predict-limit-list() { + if [[ compstate[list_lines]+BUFFERLINES -gt LINES ]]; then + compstate[list]='' + compstate[force_list]=yes + fi +} + +# Handle zsh autoloading conventions + [[ -o kshautoload ]] || predict-on "$@" |