From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23712 invoked by alias); 24 Jun 2015 01:35:31 -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: 35581 Received: (qmail 19128 invoked from network); 24 Jun 2015 01:35:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=XuFjbXds+S0K2ILUxmUEVOe3l+oxIzcMWXbMDDdXUmU=; b=LDuObAME8XCGvl5sZFPz4nk4YcFnkQh2T4IclUSuvuy56VyJ/4mR8jwUSkIxi9BNIr cHcUoQekBnZ6XWvWVTsksYxcEZEo9QQbSSMfZOxPgREr3gcLqUEVruYBOzHgoX86n28z f+vjdhEEiqs1L/prxwvE3XRBR6POPDwheokLuZEU4wse6tWeJstHVL9Pu/gKq0+aXxsF 2u40FTvv1ZnQeyJNCp6gO96zQuc1+ohoYj6XKg0NELQJE4AEDEWG+6KAkJXW2uN9YEfS fTQ2jiDqqztht+7fqcw1sh6yTiWQuvjaqNb6vwvhi8dzQh9n2RpBIWxoLB2eDkl7JYRd pukA== X-Gm-Message-State: ALoCoQl5d4uYAYtdI5zFpc46II+8A7mt4OYSLedXjRA2w0mEw/eU50I/L5yo6EvtNLBcigqA47wT X-Received: by 10.202.172.16 with SMTP id v16mr30114340oie.51.1435109724541; Tue, 23 Jun 2015 18:35:24 -0700 (PDT) From: Bart Schaefer Message-Id: <150623183520.ZM6551@torch.brasslantern.com> Date: Tue, 23 Jun 2015 18:35:20 -0700 In-Reply-To: Comments: In reply to Mikael Magnusson "Re: Typeset with array" (Jun 23, 10:24pm) References: <5578996E.3080700@thequod.de> <150610191427.ZM30841@torch.brasslantern.com> <5579C247.1060800@thequod.de> <150611183639.ZM32247@torch.brasslantern.com> <20150612094237.338f79d5@pwslap01u.europe.root.pri> <20150619123930.2688d9e3@pwslap01u.europe.root.pri> <20150621210512.113577a6@ntlworld.com> <20150621213842.621886e0@ntlworld.com> <20150623174719.43eaa1e2@pwslap01u.europe.root.pri> <150623131706.ZM6164@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "Zsh Hackers' List" Subject: typeset -p with assoc array (was Re: Typeset with array) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 23, 10:24pm, Mikael Magnusson wrote: } } > If I were going to "fix" it for no reason other than the consistency, } > I'd simply add MORE spaces rather than try to squash that one. } } This would also be consistent with xtrace output, so I agree :). This is not difficult, and doesn't conflict with the typeset-array branch as far as I can see, so ... patch below. However, it does point out that the typeset-array branch could update printparamnode() to emit typeset -a a=( b ) instead of the historic two-line format. (Urk, it'd be kind of ugly to make that depend on whether the reserved word was enabled.) diff --git a/Src/params.c b/Src/params.c index 3b75735..f8d039a 100644 --- a/Src/params.c +++ b/Src/params.c @@ -5091,8 +5091,10 @@ printparamvalue(Param p, int printflags) break; case PM_ARRAY: /* array */ - if (!(printflags & PRINT_KV_PAIR)) + if (!(printflags & PRINT_KV_PAIR)) { putchar('('); + putchar(' '); + } u = p->gsu.a->getfn(p); if(*u) { quotedzputs(*u++, stdout); @@ -5101,13 +5103,17 @@ printparamvalue(Param p, int printflags) quotedzputs(*u++, stdout); } } - if (!(printflags & PRINT_KV_PAIR)) + if (!(printflags & PRINT_KV_PAIR)) { + putchar(' '); putchar(')'); + } break; case PM_HASHED: /* association */ - if (!(printflags & PRINT_KV_PAIR)) + if (!(printflags & PRINT_KV_PAIR)) { putchar('('); + putchar(' '); + } { HashTable ht = p->gsu.h->getfn(p); if (ht)