Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Typeset with array



On Wed, 24 Jun 2015 15:00:22 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> % foo() { typeset -g foo=bar }; which foo
> foo () {
>     typeset -gfoo=bar
> }
> 
> Notice the lack of space after -g.

I've just remembered what I meant to test.

pws

diff --git a/Src/text.c b/Src/text.c
index a72ab33..3287c54 100644
--- a/Src/text.c
+++ b/Src/text.c
@@ -189,6 +189,8 @@ taddassign(wordcode code, Estate state, int typeset)
 static void
 taddassignlist(Estate state, wordcode count)
 {
+    if (count)
+	taddchr(' ');
     while (count--) {
 	wordcode code = *state->pc++;
 	taddassign(code, state, 1);
diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst
index 4afb189..e6285bc 100644
--- a/Test/B02typeset.ztst
+++ b/Test/B02typeset.ztst
@@ -651,3 +651,15 @@
 >odd
 >number
 >here
+
+  fn() { typeset foo bar thing=this stuff=(that other) more=woevva; }
+  which -x2 fn
+  fn2() { typeset assignfirst=(why not); }
+  which -x2 fn2
+0:text output from typeset
+>fn () {
+>  typeset foo bar thing=this stuff=(that other) more=woevva 
+>}
+>fn2 () {
+>  typeset assignfirst=(why not) 
+>}



Messages sorted by: Reverse Date, Date, Thread, Author