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

Re: Bug in autocompletion in CVS



Vincent Driessen wrote:
> I discovered a small bug in the version in pkgsrc/zsh. In a directory that
> contains filenames with spaces, you cannot use the tabcompletion properly whe
> n
> issueing a CVS command, for example, with these commands:
> 
> % /foo> ls
> CVS/          foo
> bar           this is a file name with spaces
> % /foo> cvs upd th[TAB]
> 
> The filename part of the command is only expanded until the "this".

Bang to rights... I think the following simplified version works,
although I don't really know why it was so complicated in the first
place, so please say if this has side effects.

I think there may be a similar problem when checking for modified files,
but as the test is currently

    [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/${slash}[^${slash}]#${slash}//}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] &&
    _wanted files expl 'modified file' _path_files -g "$pat"

I don't feel like investigating more closely at the moment.  (Is that
the World's Longest Ever Shell Substitution?)

Index: Completion/Unix/Command/_cvs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_cvs,v
retrieving revision 1.19
diff -u -r1.19 _cvs
--- Completion/Unix/Command/_cvs	8 May 2003 10:30:48 -0000	1.19
+++ Completion/Unix/Command/_cvs	3 Jul 2003 11:20:40 -0000
@@ -912,8 +912,8 @@
   linedir="$match[1]"
   realdir=${(e)~linedir}
   [[ -f "$realdir"CVS/Entries ]] &&
-  [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}}"} ]] &&
-  _wanted files expl file _path_files -g "$pat"
+  pat=(${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}%%/*})
+  (( ${#pat} )) && _wanted files expl file _path_files -a pat
 }
 
 (( $+functions[_cvs_modified_entries] )) ||

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


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



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