about summary refs log tree commit diff
path: root/Completion/Core/_normal
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core/_normal')
-rw-r--r--Completion/Core/_normal16
1 files changed, 9 insertions, 7 deletions
diff --git a/Completion/Core/_normal b/Completion/Core/_normal
index f56849194..98337eae5 100644
--- a/Completion/Core/_normal
+++ b/Completion/Core/_normal
@@ -1,6 +1,6 @@
 #autoload
 
-local comp command cmd1 cmd2 pat val name i ret
+local comp command cmd1 cmd2 pat val name i ret=1
 
 # Completing in command position? If not we set up `cmd1' and `cmd2' as
 # two strings we have search in the completion definition arrays (e.g.
@@ -9,8 +9,9 @@ local comp command cmd1 cmd2 pat val name i ret
 command="$words[1]"
 if [[ CURRENT -eq 1 ]]; then
   comp="$_comps[-command-]"
-  [[ -z "$comp" ]] || "$comp"
-  return
+  [[ -z "$comp" ]] || "$comp" && ret=0
+
+  return ret
 elif [[ "$command[1]" == '=' ]]; then
   eval cmd1\=$command
   cmd2="$command[2,-1]"
@@ -28,11 +29,10 @@ for i in "$_patcomps[@]"; do
   pat="${i% *}"
   val="${i#* }"
   if [[ "$cmd1" == $~pat || "$cmd2" == $~pat ]]; then
-    "$val"
-    ret=$?
+    "$val" && ret=0
     if (( $+_compskip )); then
       unset _compskip
-      return $ret
+      return ret
     fi
   fi
 done
@@ -53,4 +53,6 @@ if [[ -z "$comp" ]]; then
   name=-default-
   comp="$_comps[-default-]"
 fi
-[[ -z "$comp" ]] || "$comp"
+[[ -z "$comp" ]] || "$comp" && ret=0
+
+return ret