From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3880 invoked by alias); 9 Jun 2010 13:47:36 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28012 Received: (qmail 3294 invoked from network); 9 Jun 2010 13:47:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) X-Authentication-Warning: pwslap01u.europe.root.pri: pws owned process doing -bs To: zsh-workers@zsh.org (Zsh hackers list) Subject: PATCH: bug in ${(z)...} with newlines X-Mailer: MH-E 8.2; nmh 1.3; GNU Emacs 23.1.1 Date: Wed, 09 Jun 2010 14:07:39 +0100 Message-ID: <15865.1276088859@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 09 Jun 2010 13:07:42.0920 (UTC) FILETIME=[BF018480:01CB07D4] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A_09_40_00 (www.mailcontrol.com) on 10.71.0.132 This must be a bug, mustn't it? % foo=$'one\ntwo' % print ${(z)foo} one ; two As far as splitting arguments goes, the newline is just whitespace. Index: Src/hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hist.c,v retrieving revision 1.98 diff -p -u -r1.98 hist.c --- Src/hist.c 22 Mar 2010 23:20:11 -0000 1.98 +++ Src/hist.c 9 Jun 2010 13:05:20 -0000 @@ -2876,7 +2876,7 @@ bufferwords(LinkList list, char *buf, in sprintf(b, "%d%s", tokfd, tokstrings[tok]); addlinknode(list, dupstring(b)); num++; - } else if (tok != NEWLIN) { + } else if (tok != NEWLIN && tok != SEPER) { addlinknode(list, dupstring(tokstrings[tok])); num++; } Index: Test/D04parameter.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v retrieving revision 1.43 diff -p -u -r1.43 D04parameter.ztst --- Test/D04parameter.ztst 12 May 2010 10:17:58 -0000 1.43 +++ Test/D04parameter.ztst 9 Jun 2010 13:05:20 -0000 @@ -389,6 +389,14 @@ >) >ten( more + foo=$'first line\nsecond line' + print -l ${(z)foo} +0:${(z)...} with newlines +>first +>line +>second +>line + psvar=(dog) setopt promptsubst foo='It shouldn'\''t $(happen) to a %1v.' -- Peter Stephenson 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