about summary refs log tree commit diff
path: root/Completion/Base/_arguments
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Base/_arguments')
-rw-r--r--Completion/Base/_arguments22
1 files changed, 13 insertions, 9 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index 472f085d5..9a133617c 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -4,7 +4,7 @@
 # descriptions given as arguments to this function.
 
 local long cmd="$words[1]" descr mesg subopts opt usecc autod
-local oldcontext="$curcontext"
+local oldcontext="$curcontext" hasopts
 
 long=$argv[(I)--]
 if (( long )); then
@@ -230,35 +230,39 @@ if (( $# )) && comparguments -i "$autod" "$@"; then
 
             # Anything inside `(...)' is added directly.
 
-            compadd "$subopts[@]" "$expl[@]" - ${=action[2,-2]}
+            _loop arguments expl "$descr" \
+                compadd "$subopts[@]" - ${=action[2,-2]}
           elif [[ "$action" = \{*\} ]]; then
 
             # A string in braces is evaluated.
 
-            eval "$action[2,-2]"
+            _loop arguments expl "$descr" eval "$action[2,-2]"
 
           elif [[ "$action" = \ * ]]; then
 
             # If the action starts with a space, we just call it.
 
 	    eval "action=( $action )"
-            "$action[@]"
+            _loop arguments expl "$descr" "$action[@]"
           else
 
-            # Otherwise we call it with the description-arguments built above.
+            # Otherwise we call it with the description-arguments.
 
             eval "action=( $action )"
-            "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}"
+            _loop arguments expl "$descr" \
+                "$action[1]" "$subopts[@]" "${(@)action[2,-1]}"
           fi
         fi
       fi
 
-      if [[ -z "$matched" ]] && _requested options &&
+      if [[ -z "$matched$hasopts" ]] && _requested options &&
           { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
-          [[ "$origpre" = [-+]* ||
-             ( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then
+            [[ "$origpre" = [-+]* ||
+            ( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then
 	local prevpre="$PREFIX" previpre="$IPREFIX"
 
+	hasopts=yes
+
 	PREFIX="$origpre"
 	IPREFIX="$origipre"