about summary refs log tree commit diff
path: root/Completion/Base
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/_arguments21
1 files changed, 17 insertions, 4 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index e54aaf7ef..eb6ec51bc 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -226,7 +226,11 @@ while [[ cur -gt 0 ]]; do
       def="$opts[$ws[1]]"
       optbeg="$beg"
       argbeg="$beg"
-      inopt=yes
+      if [[ -n "$def" ]]; then
+        inopt=yes
+      else
+        inopt=''
+      fi
       [[ -n "$oneshot[$ws[1]]" ]] && unset "opts[$ws[1]]"
     else
       uns=''
@@ -236,7 +240,11 @@ while [[ cur -gt 0 ]]; do
 	  def="$opts[$tmp]"
 	  optbeg="$beg"
 	  argbeg="$beg"
-          inopt=yes
+	  if [[ -n "$def" ]]; then
+            inopt=yes
+	  else
+            inopt=''
+	  fi
 	  uns="${ws[1][2,-1]}"
 	  opt=''
 	fi
@@ -283,6 +291,7 @@ while [[ cur -gt 0 ]]; do
             inopt=yes
           else
             def=''
+	    inopt=''
 	  fi
         fi
       fi
@@ -318,11 +327,15 @@ while [[ cur -gt 0 ]]; do
               def="${def#?*[^\\]:*[^\\]:}"
 	      optbeg="$beg"
 	      argbeg="$beg"
-              inopt=yes
             else
               def=''
             fi
 	  fi
+          if [[ -n "$def" ]]; then
+	    inopt=yes
+          else
+	    inopt=''
+	  fi
         fi
       fi
 
@@ -453,7 +466,7 @@ else
       (( $#tmp )) && unset "$tmp[@]"
     fi
 
-    if [[ -n "$opt" ]]; then
+    if [[ -n "$opt" && "$def" != \** ]]; then
 
       # We aren't in an argument directly after a option name, so
       # all option names are possible matches.