about summary refs log tree commit diff
path: root/Completion/Core/_sep_parts
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core/_sep_parts')
-rw-r--r--Completion/Core/_sep_parts12
1 files changed, 9 insertions, 3 deletions
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}")