Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: bug with ((val\:desc ...)) actions in _alternative



This:
  _alternative 'foos:foo:((one\:a two\:b))' 'bars:bar:((a\:one b\:two))'
doesn't work.

With more than one ((...)) action in an _alternative spec, after the
first `local ws' prints the value of ws.

The second problem with it was that it was not setting the tag as
specified in the spec. So the two things were not completed separately.

Oliver

Index: Completion/Base/Utility/_alternative
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_alternative,v
retrieving revision 1.2
diff -u -r1.2 _alternative
--- Completion/Base/Utility/_alternative	22 Jan 2002 10:22:48 -0000	1.2
+++ Completion/Base/Utility/_alternative	13 Mar 2003 09:28:06 -0000
@@ -1,7 +1,7 @@
 #autoload
 
 local tags def expl descr action mesgs nm="$compstate[nmatches]" subopts
-local opt curcontext="$curcontext"
+local opt ws curcontext="$curcontext"
 
 subopts=()
 while getopts 'O:C:' opt; do
@@ -33,13 +33,12 @@
 
         mesgs=( "$mesgs[@]" "${def%%:*}:$descr")
       elif [[ "$action" = \(\(*\)\) ]]; then
-        local ws
 
         # ((...)) contains literal strings with descriptions.
 
         eval ws\=\( "${action[3,-3]}" \)
 
-        _describe "$descr" ws -M 'r:|[_-]=* r:|=*' "$subopts[@]"
+        _describe -t "${def%%:*}" "$descr" ws -M 'r:|[_-]=* r:|=*' "$subopts[@]"
       elif [[ "$action" = \(*\) ]]; then
 
         # Anything inside `(...)' is added directly.



Messages sorted by: Reverse Date, Date, Thread, Author