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

Re: The file-sort style is broken



Bart Schaefer wrote:
> schaefer[512] echo $^fpath/_zip(N)
> /usr/share/zsh/4.2.0/functions/_zip
> schaefer[513] unzip -<TAB>
> No matches for `zip file'
> 
> (Huh?  Why is it trying to complete a zip file after a hyphen, rather
> than completing options?)

Do you have a matcher style set which assumes `-' is an anchor
character?

> Here's a snippet from the _complete_debug output:
> 
> : _path_files:126:then else for elif-then; tmp2=( '(#i)*.(zip|[ejw]ar)(om#q-.
> )' )
> 
> See where the "om" has been inserted?  Bad, very bad.

How about the following?

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.23
diff -u -r1.23 _path_files
--- Completion/Unix/Type/_path_files	8 May 2003 10:30:49 -0000	1.23
+++ Completion/Unix/Type/_path_files	27 Apr 2004 15:00:34 -0000
@@ -120,7 +120,9 @@
 
     tmp2=()
     for tmp1 in "$pats[@]"; do
-      if [[ "$tmp1" = (#b)(*[^\$])(\(\([^\|~]##\)\)) ]]; then
+      if [[ "$tmp1" = (#b)(*[^\$])"(#q"(*)")" ]]; then
+	tmp2=( "$tmp2[@]" "${match[1]}(#q${sort}${match[2]})" )
+      elif [[ "$tmp1" = (#b)(*[^\$])(\(\([^\|~]##\)\)) ]]; then
         tmp2=( "$tmp2[@]" "${match[1]}((${sort}${match[2][3,-1]}" )
       elif [[ "$tmp1" = (#b)(*[^\$])(\([^\|~]##\)) ]]; then
         tmp2=( "$tmp2[@]" "${match[1]}(${sort}${match[2][2,-1]}" )

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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