From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Completion of files in subdirectories
Date: Fri, 02 Sep 2011 09:08:28 -0700 [thread overview]
Message-ID: <110902090828.ZM8349@torch.brasslantern.com> (raw)
In-Reply-To: <20110902112306.GT3403@xvii.vinc17.org>
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
next prev parent reply other threads:[~2011-09-02 16:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-02 11:23 Vincent Lefevre
2011-09-02 13:10 ` Simon Ruderich
2011-09-02 13:16 ` Mikael Magnusson
2011-09-02 16:08 ` Bart Schaefer [this message]
2011-09-03 20:34 ` Simon Ruderich
2011-09-05 21:34 ` Alexey I. Froloff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=110902090828.ZM8349@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).