summary refs log tree commit diff
path: root/Functions/Zle/incremental-complete-word
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-05 08:49:50 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-05 08:49:50 +0000
commitdb663c824a1b7167618c41d72b0c25a69b7ee91c (patch)
treec78de2b58eddf1e59fa19aa02ffe2b48f316ff32 /Functions/Zle/incremental-complete-word
parentbcd865f7d2f09fb42c755f0ad7f26f7ed26a60f0 (diff)
downloadzsh-db663c824a1b7167618c41d72b0c25a69b7ee91c.tar.gz
zsh-db663c824a1b7167618c41d72b0c25a69b7ee91c.tar.xz
zsh-db663c824a1b7167618c41d72b0c25a69b7ee91c.zip
$PENDING special zle parameter, giving number of un-read bytes
Diffstat (limited to 'Functions/Zle/incremental-complete-word')
-rw-r--r--Functions/Zle/incremental-complete-word42
1 files changed, 23 insertions, 19 deletions
diff --git a/Functions/Zle/incremental-complete-word b/Functions/Zle/incremental-complete-word
index e021bf6f7..6e61f5998 100644
--- a/Functions/Zle/incremental-complete-word
+++ b/Functions/Zle/incremental-complete-word
@@ -75,27 +75,31 @@ incremental-complete-word() {
     else
       LBUFFER="$LBUFFER$key"
     fi
-    lastl="$LBUFFER"
-    lastr="$RBUFFER"
-    [[ "$twid" = "$wid" ]] && comppostfuncs=( "$post[@]" )
-    toolong=''
-    zle $twid "$@"
-    LBUFFER="$lastl"
-    RBUFFER="$lastr"
-    num=$_lastcomp[nmatches]
-    if (( ! num )); then
-      word=''
-      state='-no match-'
-    elif [[ "${LBUFFER}${RBUFFER}" = *${_lastcomp[unambiguous]}* ]]; then
-      word=''
-      state='-no prefix-'
+    if (( ! PENDING )); then
+      lastl="$LBUFFER"
+      lastr="$RBUFFER"
+      [[ "$twid" = "$wid" ]] && comppostfuncs=( "$post[@]" )
+      toolong=''
+      zle $twid "$@"
+      LBUFFER="$lastl"
+      RBUFFER="$lastr"
+      num=$_lastcomp[nmatches]
+      if (( ! num )); then
+        word=''
+        state='-no match-'
+      elif [[ "${LBUFFER}${RBUFFER}" = *${_lastcomp[unambiguous]}* ]]; then
+        word=''
+        state='-no prefix-'
+      else
+        word="${_lastcomp[unambiguous]}"
+        state=''
+      fi
+      zformat -f pstr "$pmpt" "u:${word}" "s:$state" "n:$num" \
+                              "l:$toolong" "c:${_lastcomp[completer][2,-1]}"
+      zle -R "$pstr"
     else
-      word="${_lastcomp[unambiguous]}"
-      state=''
+      zle -R
     fi
-    zformat -f pstr "$pmpt" "u:${word}" "s:$state" "n:$num" \
-                            "l:$toolong" "c:${_lastcomp[completer][2,-1]}"
-    zle -R "$pstr"
     read -k key
   done