From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: bug in ${(z)...} with newlines
Date: Wed, 16 Jun 2010 15:06:53 -0700 [thread overview]
Message-ID: <AANLkTinXfjZZ5WKGOn18EM56mo5Vjwm28yjTXwfZS-8t@mail.gmail.com> (raw)
In-Reply-To: <20100609165429.7e19ca2c@csr.com>
Sorry to have left this sit so long, I had relatives in town for my
son's high school graduation and wasn't really keeping up with all my
email.
On Wed, Jun 9, 2010 at 8:54 AM, Peter Stephenson
<Peter.Stephenson@csr.com> wrote:
> On Wed, 9 Jun 2010 07:34:47 -0700
> Bart Schaefer <schaefer@brasslantern.com> wrote:
>> On Wed, Jun 9, 2010 at 6:07 AM, Peter Stephenson <pws@csr.com> wrote:
>> > This must be a bug, mustn't it?
>> >
>> > % foo=$'one\ntwo'
>> > % print ${(z)foo}
>> > one ; two
>>
>> Yes, but (z) is really for parsing, not merely splitting.
>
> Hmm. I've only ever used (z) for splitting words (which is why it was 'z',
> since 's' was used), which is my memory of why it was introduced. Now
> you're telling me it's for something other than what it says in the manual
> which just says parsing is to find the words, and I can't use it without
> jumping through hoops. Nor can I think of a case where I would use it to
> find lines of code.
I did a dive into the list archive and the addition of (z) originated
with this remark by Felix Rosencrantz (zsh-workers/10951):
-> I wasn't sure how to break up the values of $history to find the start
-> of commands, and to break up along word boundaries. I was thinking
-> that we might need C code support for that.
Sven proposed something unworkable involving $historywords, and I replied with:
+> I think having a way to chop a string into shell words -- something like
+> what you did for copy-prev-shell-word -- would be more effective.
This eventually resulted in Sven posting the patch for (z).
Now, this was all in the context of the _history completer which may
very well by now be doing its thing in an entirely different way -- I
don't find any use of (z) in _history or indeed anywhere in
Completion/**/*(.) [scanning with egrep] that conflicts with your
proposed change. I just want to make sure the ramifications have been
considered.
> I can certainly believe the completion system, which uses the same code
> underneath, might be relying on undocumented 'intentional' features.
I find calls to bufferwords() in Zle/{zle_hist,zle_misc}.c and subst.c
but not in completion (oddly, as a comment indicates that's where it
originally came from). The only place your change may have a
detectable effect is in the implementation of copyprevshellword() in
zle_misc.
next prev parent reply other threads:[~2010-06-16 23:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-09 13:07 Peter Stephenson
2010-06-09 14:34 ` Bart Schaefer
2010-06-09 14:36 ` Bart Schaefer
2010-06-09 15:54 ` Peter Stephenson
2010-06-16 22:06 ` Bart Schaefer [this message]
2010-06-16 22:13 ` Bart Schaefer
2010-06-17 11:50 ` Peter Stephenson
2010-06-17 16:42 ` Bart Schaefer
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=AANLkTinXfjZZ5WKGOn18EM56mo5Vjwm28yjTXwfZS-8t@mail.gmail.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).