zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: bug in ${(z)...} with newlines
@ 2010-06-09 13:07 Peter Stephenson
  2010-06-09 14:34 ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Stephenson @ 2010-06-09 13:07 UTC (permalink / raw)
  To: Zsh hackers list

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 <pws@csr.com>            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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-06-17 16:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-09 13:07 PATCH: bug in ${(z)...} with newlines 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
2010-06-16 22:13       ` Bart Schaefer
2010-06-17 11:50         ` Peter Stephenson
2010-06-17 16:42           ` Bart Schaefer

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).