Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: bug in ${(z)...} with newlines
- X-seq: zsh-workers 28015
- From: Peter Stephenson <Peter.Stephenson@xxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: bug in ${(z)...} with newlines
- Date: Wed, 9 Jun 2010 16:54:29 +0100
- In-reply-to: <AANLkTimJ0WzSVNKMz7UEYVX2yiBI3Mn16avrF2Z9-E4E@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
- References: <15865.1276088859@xxxxxxx> <AANLkTimJ0WzSVNKMz7UEYVX2yiBI3Mn16avrF2Z9-E4E@xxxxxxxxxxxxxx>
On Wed, 9 Jun 2010 07:34:47 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Wed, Jun 9, 2010 at 6:07 AM, Peter Stephenson <pws@xxxxxxx> wrote:
> > This must be a bug, mustn't it?
> >
> > % foo=$'one\ntwo'
> > % print ${(z)foo}
> > one ; two
>
> I'm pretty sure that's intentional, so that when the newline is
> removed by splitting, the join is still a semantically equivalent
> shell expression. Otherwise you can't do stuff like this:
>...
> > As far as splitting arguments goes, the newline is just whitespace.
>
> 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 can certainly believe the completion system, which uses the same code
underneath, might be relying on undocumented 'intentional' features.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author