zsh-workers
 help / color / mirror / code / Atom feed
* Quoting problems with _zip (unzip) completer
@ 2009-08-03 20:15 Mikael Magnusson
  2009-08-04  8:50 ` Peter Stephenson
  0 siblings, 1 reply; 16+ messages in thread
From: Mikael Magnusson @ 2009-08-03 20:15 UTC (permalink / raw)
  To: zsh-workers

Completing contents of zip files with metachars doesn't work,
completing actual files in a zip file that you have renamed also
doesn't work properly. These issues seem to be separate, but I could
be wrong. While hacking around in _zip it seems like I "fixed" at
least the first thing.

The most obvious example is:
% touch a b c
% zip test.zip a b c
% unzip test.zip <tab completes fine>a
% mv test.zip test\[.zip
% unzip test\[.zip <tab>
_zip:117: bad pattern: test[.zip(|.zip|.ZIP)
_zip:117: bad pattern: test[.zip(|.zip|.ZIP)
_zip:117: bad pattern: test[.zip(|.zip|.ZIP)

naming the file test[].zip which is a valid pattern simply doesn't
give any matches. Naming the files inside the zip file and calling it
test.zip fails in various ways, sometimes it just completes the last
file without giving a list, even though set -x shows the full file
list being passed to the completion system, and typing a partial name
+ tab completes that file. Mysterious.

The change I did that seems to solve the actual .zip file name issue is:

@@ -114,7 +114,7 @@ case $state in
     if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then
       _wanted files expl zfile _files -g
'^(#i)*.(zip|xpi|[ejw]ar)(-.)' && return
     else
-      zipfile=( $~line[1](|.zip|.ZIP) )
+      zipfile=( $line[1](|.zip|.ZIP) )
       [[ -z $zipfile[1] ]] && return 1
       if [[ $zipfile[1] !=  $_zip_cache_list ]]; then
 	_zip_cache_name="$zipfile[1]"

i.e. remove the ~. I didn't test if this breaks completion if you
didn't type the ".zip" part of the filename. I've fiddled around
adding (q) and quotes everywhere but it doesn't seem to improve
matters any.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-02-04 14:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-03 20:15 Quoting problems with _zip (unzip) completer Mikael Magnusson
2009-08-04  8:50 ` Peter Stephenson
2009-08-04 16:31   ` Mikael Magnusson
2009-08-17 20:58   ` Peter Stephenson
2009-08-17 21:49     ` Peter Stephenson
2009-08-17 21:59       ` Nikolai Weibull
2009-08-18  9:10         ` Peter Stephenson
2010-02-03  1:16     ` Mikael Magnusson
2010-02-03 22:09       ` Peter Stephenson
2010-02-03 22:43         ` Mikael Magnusson
2010-02-03 23:11           ` Benjamin R. Haskell
2010-02-03 23:21             ` Benjamin R. Haskell
2010-02-04 10:03           ` Peter Stephenson
2010-02-04 11:37         ` Peter Stephenson
2010-02-04 14:15           ` Benjamin R. Haskell
2010-02-04 14:22             ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).