about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Base/_arguments21
-rw-r--r--Completion/Core/_message2
-rw-r--r--Doc/Zsh/compsys.yo10
3 files changed, 24 insertions, 9 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index 5e0d35d44..9e9c4e892 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -3,7 +3,9 @@
 # Complete the arguments of the current command according to the
 # descriptions given as arguments to this function.
 
-local long args rest ws cur nth def nm expl descr action opt arg tmp
+setopt localoptions extendedglob
+
+local long args rest ws cur nth def nm expl descr action opt arg tmp ret=1
 
 # Associative arrays used to collect information about the options.
 
@@ -336,10 +338,17 @@ else
       # We aren't in an argument directly after a option name, so
       # all option names are possible matches.
 
-      _description expl option
-      compadd "$expl[@]" - "${(@k)opts}" "${(@k)mopts}" \
-                           "${(@k)dopts}" "${(@k)dmopts}" \
-			   "${(@k)odopts}" "${(@k)odmopts}"
+      if [[ "$compconfig[option_prefix]" != *(short|all)* ||
+            "$PREFIX" = -* ]]; then
+        _description expl option
+        compadd "$expl[@]" - "${(@k)opts}" "${(@k)mopts}" \
+                             "${(@k)dopts}" "${(@k)dmopts}" \
+			     "${(@k)odopts}" "${(@k)odmopts}" && ret=0
+      fi
+      [[ $#long -ne 0 &&
+         ( "$compconfig[option_prefix]" != *(long|all)* ||
+           "$PREFIX" = --* ) ]] && \
+          _long_options && ret=0
     fi
   fi
 
@@ -362,7 +371,7 @@ else
 
       # An empty action means that we should just display a message.
       _message "$descr"
-      return 1
+      return ret
     elif [[ "$action[1]" = \( ]]; then
 
       # Anything inside `(...)' is added directly.
diff --git a/Completion/Core/_message b/Completion/Core/_message
index 7f353b7c0..e36d8b36e 100644
--- a/Completion/Core/_message
+++ b/Completion/Core/_message
@@ -14,6 +14,4 @@ if [[ -n "$format" ]]; then
     compadd -X "${format//\\%d/$1}" -n ''
   fi
   compstate[force_list]=yes
-else
-  compadd -n ''
 fi
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 13659a92b..4b80fc9db 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -215,7 +215,7 @@ tt(#compdef -p) function tag.
 The fourth form is like the third, but the var(function) will be
 called only if no function for the command itself was found or if one
 was found and it set the tt(_compskip) parameter to a value em(not)
-containing the sub-string `tt(patterns)'.
+containing the substring `tt(patterns)'.
 
 The fifth form defines a widget with the same name as the var(function)
 which will be called for each of the var(key-sequences); this is like the
@@ -944,6 +944,14 @@ tt(_long_options) function where appropriate by giving it the string
 `tt(--)' as an argument. All arguments after this will be given
 unchanged to the tt(_long_options) function.
 
+This function also uses one configuration key: tt(option_prefix). If
+this is set to a string containing `tt(short)' or `tt(all)' as a
+substring, option names beginning with a single minus sign are added
+as possible matches only if the word on the line begins with a minus
+sign. If the value contains one of the substrings `tt(long)' or
+`tt(all)', option names beginning with two minus signs will be
+added as matches only if the two minus signs are given on the line.
+
 Example:
 
 example(_arguments '-l+:left border:' \