summaryrefslogtreecommitdiffstats
path: root/Functions
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-03-04 19:54:55 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-03-04 19:54:55 +0000
commit42a779d5c2ac7cb694845df7a35244f7fb7b2ce3 (patch)
tree35b8810b386bac3073decb2e2e231c0baab143d6 /Functions
parentzsh-workers/9990 (diff)
downloadzsh-42a779d5c2ac7cb694845df7a35244f7fb7b2ce3.tar
zsh-42a779d5c2ac7cb694845df7a35244f7fb7b2ce3.tar.gz
zsh-42a779d5c2ac7cb694845df7a35244f7fb7b2ce3.tar.bz2
zsh-42a779d5c2ac7cb694845df7a35244f7fb7b2ce3.tar.lz
zsh-42a779d5c2ac7cb694845df7a35244f7fb7b2ce3.tar.xz
zsh-42a779d5c2ac7cb694845df7a35244f7fb7b2ce3.tar.zst
zsh-42a779d5c2ac7cb694845df7a35244f7fb7b2ce3.zip
zsh-workers/9992
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Zle/predict-on21
1 files changed, 15 insertions, 6 deletions
diff --git a/Functions/Zle/predict-on b/Functions/Zle/predict-on
index 04cba8297..c56198a55 100644
--- a/Functions/Zle/predict-on
+++ b/Functions/Zle/predict-on
@@ -36,10 +36,15 @@ predict-off() {
zle -A .backward-delete-char backward-delete-char
}
insert-and-predict () {
- emulate -L zsh
- if [[ ${RBUFFER[1]} = ${KEYS[-1]} ]]
+ setopt localoptions noshwordsplit noksharrays
+ if [[ $LBUFFER = *$'\012'* ]]
then
- # same as what's typed, just move on
+ # Editing a multiline buffer, it's unlikely prediction is wanted
+ zle .$WIDGET "$@"
+ return
+ elif [[ ${RBUFFER[1]} = ${KEYS[-1]} ]]
+ then
+ # Same as what's typed, just move on
((++CURSOR))
else
LBUFFER="$LBUFFER$KEYS"
@@ -92,12 +97,15 @@ insert-and-predict () {
return 0
}
delete-backward-and-predict() {
- emulate -L zsh
if [[ -n "$LBUFFER" ]]
then
+ setopt localoptions noshwordsplit noksharrays
+ if [[ $LBUFFER = *$'\012'* ]] then
+ # Editing a multiline buffer, it's unlikely prediction is wanted
+ zle .$WIDGET "$@"
# If the last widget was e.g. a motion, then probably the intent is
# to actually edit the line, not change the search prefix.
- if [[ $LASTWIDGET == (self-insert|magic-space|backward-delete-char) ]]
+ elif [[ $LASTWIDGET == (self-insert|magic-space|backward-delete-char) ]]
then
((--CURSOR))
zle .history-beginning-search-forward || RBUFFER=""
@@ -118,7 +126,8 @@ delete-no-predict() {
predict-limit-list() {
if (( compstate[list_lines]+BUFFERLINES > LINES ||
- ( compstate[list_max] != 0 && compstate[nmatches] > compstate[list_max] ) ))
+ ( compstate[list_max] != 0 &&
+ compstate[nmatches] > compstate[list_max] ) ))
then
compstate[list]=''
compstate[force_list]=yes