about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Core/_multi_parts6
-rw-r--r--Completion/Core/_path_files8
-rw-r--r--Completion/Core/_sep_parts12
3 files changed, 20 insertions, 6 deletions
diff --git a/Completion/Core/_multi_parts b/Completion/Core/_multi_parts
index 056f44bdd..935b13c74 100644
--- a/Completion/Core/_multi_parts
+++ b/Completion/Core/_multi_parts
@@ -93,7 +93,11 @@ while true; do
   else
     # No exact match, see how many strings match what's on the line.
 
-    compadd -O tmp1 - "${(@)matches%%${sep}*}"
+    builtin compadd -O tmp1 - "${(@)matches%%${sep}*}"
+
+    [[ $#tmp1 -eq 0 && -n "$_comp_correct" ]] &&
+      compadd -O tmp1 - "${(@)matches%%${sep}*}"
+
     tmp2=( "$tmp1[@]" )
     tmp1=( "$tmp2[@]" )
 
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index 9da2fdd81..55d0aefa9 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -265,8 +265,12 @@ for prepath in "$prepaths[@]"; do
     if [[ -n "$PREFIX$SUFFIX" ]]; then
       # See which of them match what's on the line.
 
-      tmp2=("$tmp1[@]")
-      compadd -D tmp1 "$ignore[@]" "$matcher[@]" - "${(@)tmp1:t}"
+      builtin compadd -D tmp1 "$ignore[@]" "$matcher[@]" - "${(@)tmp1:t}"
+
+      if [[ $#tmp1 -eq 0 && -n "$_comp_correct" ]]; then
+        tmp1=( "$tmp2[@]" )
+	compadd -D tmp1 "$ignore[@]" "$matcher[@]" - "${(@)tmp2:t}"
+      fi
 
       # If no file matches, save the expanded path and continue with
       # the outer loop.
diff --git a/Completion/Core/_sep_parts b/Completion/Core/_sep_parts
index ca97113b1..88e46e1f5 100644
--- a/Completion/Core/_sep_parts
+++ b/Completion/Core/_sep_parts
@@ -63,7 +63,9 @@ while [[ $# -gt 1 ]]; do
   # Get the matching array elements.
 
   PREFIX="${str%%${sep}*}"
-  compadd -O testarr - "${(@P)arr}"
+  builtin compadd -O testarr - "${(@P)arr}"
+  [[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
+    compadd -O testarr - "${(@P)arr}"
 
   # If there are no matches we give up. If there is more than one
   # match, this is the part we will complete.
@@ -91,7 +93,9 @@ if [[ $# -le 1 || "$str" != *${2}* ]]; then
   # No more separators, build the matches.
 
   PREFIX="$str"
-  compadd -O testarr - "${(@P)arr}"
+  builtin compadd -O testarr - "${(@P)arr}"
+  [[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
+    compadd -O testarr - "${(@P)arr}"
 fi
 
 [[ $#testarr -eq 0 || ${#testarr[1]} -eq 0 ]] && return 1
@@ -126,7 +130,9 @@ while [[ $# -gt 0 && "$str" == *${1}* ]]; do
     arr=tmparr
   fi
 
-  compadd -O tmparr - "${(@P)arr}"
+  builtin compadd -O tmparr - "${(@P)arr}"
+  [[ $#tmparr -eq 0 && -n "$_comp_correct" ]] &&
+    compadd -O tmparr - "${(@P)arr}"
 
   suffixes=("${(@)^suffixes[@]}${1}${(@)^tmparr}")