From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: predict-on: suppress long listings
Date: Tue, 26 Oct 1999 16:08:25 +0000 [thread overview]
Message-ID: <991026160826.ZM1681@candle.brasslantern.com> (raw)
This is based on Sven's suggestion from 8399. Also deletes two extraneous
setopts. Requires two patches I posted previously in 8364 and 8373.
The +h in "local -a +h comppostfuncs" is unnecessary, but just in case it
ever becomes a special as part of moving common completion ops into C ...
Index: 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 @@
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 @@
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 "$@"
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
next reply other threads:[~1999-10-26 16:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-26 16:08 Bart Schaefer [this message]
1999-10-27 14:03 Sven Wischnowsky
1999-10-27 15:51 ` Bart Schaefer
1999-10-27 16:10 ` Bart Schaefer
1999-10-27 16:15 ` Bart Schaefer
1999-10-28 8:03 Sven Wischnowsky
1999-11-02 19:05 ` Bart Schaefer
1999-11-03 8:11 Sven Wischnowsky
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=991026160826.ZM1681@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--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).