zsh-users
 help / color / mirror / code / Atom feed
* Completion of files in subdirectories
@ 2011-09-02 11:23 Vincent Lefevre
  2011-09-02 13:10 ` Simon Ruderich
  2011-09-02 16:08 ` Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Vincent Lefevre @ 2011-09-02 11:23 UTC (permalink / raw)
  To: zsh-users

It seems that the completion of files in subdirectories is broken
for commands that have a filter on the extension (e.g. ".pdf" for
xpdf, ".html" for lynx). For instance, I have a directory with:

  bar.html  foo.pdf

In this directory:

ypig% lynx [Tab]
bar.html   file:      ftp://     gopher://  http://    https://

and

ypig% xpdf [Tab]

gives foo.pdf as expected. But if I go to the parent directory:

ypig% lynx dir/[Tab]
bar.html  foo.pdf

ypig% xpdf dir/[Tab]
bar.html  foo.pdf

while I would have expected bar.html and foo.pdf respectively.

This is with: zsh 4.3.12-dev-1-cvs0820

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


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

* Re: Completion of files in subdirectories
  2011-09-02 11:23 Completion of files in subdirectories Vincent Lefevre
@ 2011-09-02 13:10 ` Simon Ruderich
  2011-09-02 13:16   ` Mikael Magnusson
  2011-09-02 16:08 ` Bart Schaefer
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Ruderich @ 2011-09-02 13:10 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 796 bytes --]

On Fri, Sep 02, 2011 at 01:23:06PM +0200, Vincent Lefevre wrote:
> It seems that the completion of files in subdirectories is broken
> for commands that have a filter on the extension (e.g. ".pdf" for
> xpdf, ".html" for lynx). For instance, I have a directory with:
>
> [snip]
>
> This is with: zsh 4.3.12-dev-1-cvs0820

I have a similar issue but in my case no files are completed.

    $ zsh -f
    % autoload compinit && compinit
    % xpdf dir/[Tab]

Yields only directories, no *.pdf (or other) files.

I bisected the problem and it looks like it's 29444:
Completion/Unix/Type/_path_files from 2011-06-04. If I revert
that change everything works fine.

Regards,
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: Completion of files in subdirectories
  2011-09-02 13:10 ` Simon Ruderich
@ 2011-09-02 13:16   ` Mikael Magnusson
  0 siblings, 0 replies; 6+ messages in thread
From: Mikael Magnusson @ 2011-09-02 13:16 UTC (permalink / raw)
  To: Simon Ruderich; +Cc: zsh-users

On 2 September 2011 15:10, Simon Ruderich <simon@ruderich.org> wrote:
> On Fri, Sep 02, 2011 at 01:23:06PM +0200, Vincent Lefevre wrote:
>> It seems that the completion of files in subdirectories is broken
>> for commands that have a filter on the extension (e.g. ".pdf" for
>> xpdf, ".html" for lynx). For instance, I have a directory with:
>>
>> [snip]
>>
>> This is with: zsh 4.3.12-dev-1-cvs0820
>
> I have a similar issue but in my case no files are completed.
>
>    $ zsh -f
>    % autoload compinit && compinit
>    % xpdf dir/[Tab]
>
> Yields only directories, no *.pdf (or other) files.
>
> I bisected the problem and it looks like it's 29444:
> Completion/Unix/Type/_path_files from 2011-06-04. If I revert
> that change everything works fine.

Fwiw, current zsh cvs works with my setup, i get only the pdf files
and other subdirs, but i get the same result as simon with that
command sequence.

-- 
Mikael Magnusson


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

* Re: Completion of files in subdirectories
  2011-09-02 11:23 Completion of files in subdirectories Vincent Lefevre
  2011-09-02 13:10 ` Simon Ruderich
@ 2011-09-02 16:08 ` Bart Schaefer
  2011-09-03 20:34   ` Simon Ruderich
  2011-09-05 21:34   ` Alexey I. Froloff
  1 sibling, 2 replies; 6+ messages in thread
From: Bart Schaefer @ 2011-09-02 16:08 UTC (permalink / raw)
  To: zsh-users

On Sep 2,  1:23pm, Vincent Lefevre wrote:
} Subject: Completion of files in subdirectories
}
} It seems that the completion of files in subdirectories is broken
} for commands that have a filter on the extension (e.g. ".pdf" for
} xpdf, ".html" for lynx).

Hrm.

I really have only the most general notion of whether the comment I
have added in the patch below is correct.  There are way too many
possible variations here.  In particular I could imagine a command
that wants to filter out subtrees by pattern on the directory name.

Index: Completion/Unix/Type/_path_files
===================================================================
--- Completion/Unix/Type/_path_files	1 Jun 2011 06:39:59 -0000
+++ Completion/Unix/Type/_path_files	2 Sep 2011 15:56:52 -0000
@@ -438,8 +438,19 @@
 
     tmp2=( "$tmp1[@]" )
 
-    if [[ "$tpre$tsuf" = */* ]]; then
-      compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]"
"$sdirs" fake
+    if [[ "$tpre$tsuf" = (#b)*/(*) ]]; then
+
+      # We are going to be looping over the leading path segments.
+      # This means we should not apply special-dirs handling unless
+      # the path tail is a fake directory that needs to be simulated,
+      # and we should not apply pattern matching until we are looking
+      # for files rather than for intermediate directories.
+
+      if [[ -n "$fake${match[1]}" ]]; then
+        compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake
+      else
+        compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" '' fake
+      fi
     elif [[ "$sopt" = *[/f]* ]]; then
       compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]"
"$sdirs" fake "$pats[@]"
     else


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

* Re: Completion of files in subdirectories
  2011-09-02 16:08 ` Bart Schaefer
@ 2011-09-03 20:34   ` Simon Ruderich
  2011-09-05 21:34   ` Alexey I. Froloff
  1 sibling, 0 replies; 6+ messages in thread
From: Simon Ruderich @ 2011-09-03 20:34 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

On Fri, Sep 02, 2011 at 09:08:28AM -0700, Bart Schaefer wrote:
> Hrm.
>
> I really have only the most general notion of whether the comment I
> have added in the patch below is correct.  There are way too many
> possible variations here.  In particular I could imagine a command
> that wants to filter out subtrees by pattern on the directory name.

Hi Bart,

Thanks for the patch, works fine for me.

Regards,
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: Completion of files in subdirectories
  2011-09-02 16:08 ` Bart Schaefer
  2011-09-03 20:34   ` Simon Ruderich
@ 2011-09-05 21:34   ` Alexey I. Froloff
  1 sibling, 0 replies; 6+ messages in thread
From: Alexey I. Froloff @ 2011-09-05 21:34 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

On Fri, Sep 02, 2011 at 09:08:28AM -0700, Bart Schaefer wrote:
> I really have only the most general notion of whether the comment I
> have added in the patch below is correct.  There are way too many
> possible variations here.  In particular I could imagine a command
> that wants to filter out subtrees by pattern on the directory name.
This also fixes my list-dirs-first/group-name issue, thanks.

-- 
Regards,    --
Sir Raorn.   --- http://thousandsofhate.blogspot.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2011-09-05 21:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02 11:23 Completion of files in subdirectories Vincent Lefevre
2011-09-02 13:10 ` Simon Ruderich
2011-09-02 13:16   ` Mikael Magnusson
2011-09-02 16:08 ` Bart Schaefer
2011-09-03 20:34   ` Simon Ruderich
2011-09-05 21:34   ` Alexey I. Froloff

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).