From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH (?) Re: strange completion
Date: Fri, 03 Jun 2011 01:34:07 -0700 [thread overview]
Message-ID: <110603013407.ZM16592@torch.brasslantern.com> (raw)
In-Reply-To: <110602071346.ZM15593@torch.brasslantern.com>
On Jun 2, 7:13am, Bart Schaefer wrote:
}
} I'm not sure whether the following is the correct fix, or whether that
} entire if/elif/else cascade should be wrapped in
}
} if [[ -n "$fake" ]]; then
That last idea is definitely wrong, at the least the "else" branch needs
to be taken, but this --
} + if [[ "$tpre$tsuf" = */* && -n "$fake" ]]; then
-- is also too much. It's OK for $fake to be empty as long as there is
something after the final slash in "$tpre$tsuf".
I was mildly surprised to discover that in [[ ... && ... ]] the stuff
to the left of the && is evaluated before expanding variables in the
stuff to the right of the &&. The question for the patch below is,
in [[ foo/bar/ = (#b)*/(*) ]] is $match[1] guaranteed to be empty?
Or do I need ([^/]#) to be safe?
And jeez, somebody really needs to document compfiles *somewhere*. I
recall we didn't want it detailed in the man page doc for some reason,
but ...
Index: Completion/Unix/Type/_path_files
===================================================================
--- Completion/Unix/Type/_path_files 1 Jun 2011 06:39:59 -0000
+++ Completion/Unix/Type/_path_files 3 Jun 2011 08:12:48 -0000
@@ -438,7 +438,7 @@
tmp2=( "$tmp1[@]" )
- if [[ "$tpre$tsuf" = */* ]]; then
+ if [[ "$tpre$tsuf" = (#b)*/(*) && -n "$fake${match[1]}" ]]; then
compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake
elif [[ "$sopt" = *[/f]* ]]; then
compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake "$pats[@]"
next prev parent reply other threads:[~2011-06-03 8:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4DE6ABF6.10405@sergio.spb.ru>
[not found] ` <110601194609.ZM14369@torch.brasslantern.com>
[not found] ` <4DE765F2.5000704@sergio.spb.ru>
2011-06-02 14:13 ` Bart Schaefer
2011-06-03 8:34 ` Bart Schaefer [this message]
2011-09-05 19:11 ` Alexey I. Froloff
2011-09-05 20:42 ` Bart Schaefer
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=110603013407.ZM16592@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@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).