about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
Diffstat (limited to 'Functions')
-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