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

Re: false prefix-needed in _arguments



Oliver Kiddle wrote:

> The prefix-needed style in _arguments doesn't seem to be working:
> 
> _f() { _arguments '-a' '-b' '1:files:_files' }
> zstyle '*' prefix-needed false
> compdef _f f
> f <tab>
> 
> And only files are offered. It should be offering both files and
> options.

Yes, that was broken... but note taht you also have to set the
tag-order style to try options and the argument-completion at the same
time, otherwise arguments will always be preferred.


Bye
  Sven

Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.10
diff -u -r1.10 _arguments
--- Completion/Base/Utility/_arguments	22 Jan 2002 10:22:48 -0000	1.10
+++ Completion/Base/Utility/_arguments	18 Feb 2002 14:24:13 -0000
@@ -331,11 +331,10 @@
           fi
         done
       fi
-      if [[ -z "$hasopts" &&
+      if _requested options &&
+         [[ -z "$hasopts" &&
             -z "$matched" &&
-            ( -z "$tried" || -n "$alwopt" ) &&
             ( -z "$aret" || "$PREFIX" = "$origpre" ) ]] &&
-          _requested options &&
           { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
             [[ "$origpre" = [-+]* || -z "$aret$mesg$tried" ]] } ; then
 	local prevpre="$PREFIX" previpre="$IPREFIX"

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



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