From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2919 invoked by alias); 28 Sep 2014 13:40:26 -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: 33261 Received: (qmail 6361 invoked from network); 28 Sep 2014 13:40:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=K5A9l17LCEpFa/uDw1E1bee2yFDnl0D86uxaxRxsOLY=; b=S7PCNa0hZybm5zKlClnGujN8nqsj00fNC39J/k48AVaycW0vF5dxkqN4cEUS7pUYd2 8Ng1OAiVmCir3goFnAtJG1DEXzbZL6985p7biiIsQPzYG3qw2J2hB7feayq9cbAWc4hS Frlg92172S984nuZOrc+1V+mKOYuDF+g8ixDW44muMeWgm5eJapyazUcJ6ZvLB574PwS /9K0JyiT6GAqulzUzejtDbAQbP49G9OEwk7gUD1Wisn0q5g5ba8Im/JiSluKz9udbjKh 3YyJPUvTg/31aw+/RhOmgpyXdrsTlp5djgZocXUQqdiRb+jwr1WGlHf/jZamfA9whqK1 d+Bw== X-Gm-Message-State: ALoCoQkGB2aNsltJPNQsj2BQep81MOUqhDkHTaUXijeMrg2lUOHSAlLaxPJIy7JgjtLFmaV2hCyl MIME-Version: 1.0 X-Received: by 10.194.57.237 with SMTP id l13mr3066574wjq.102.1411911617268; Sun, 28 Sep 2014 06:40:17 -0700 (PDT) X-Originating-IP: [2602:30a:2c91:e650:922b:34ff:fe5f:bfd2] In-Reply-To: <140926213949.ZM6043@torch.brasslantern.com> References: <140926213949.ZM6043@torch.brasslantern.com> Date: Sun, 28 Sep 2014 08:40:17 -0500 Message-ID: Subject: Re: bug with %<< prompt expansion From: Joel Elkins To: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary=047d7b86c92e67008e0504204a60 --047d7b86c92e67008e0504204a60 Content-Type: text/plain; charset=UTF-8 I tested this patch and can confirm it fixes the issues on my end. Thanks, Joel On Fri, Sep 26, 2014 at 11:39 PM, Bart Schaefer wrote: > On Sep 26, 6:27pm, Joel Elkins wrote: > } > } % print -P "%4>.>12345" > } 123. > } % print -P "%4>.>1%{%}2345" > } 12. > } > } In my opinion, these two commands should have the same output. > > Right you are. I'm not entirely sure why this doesn't seem to affect > %<< but it looks like it has the same logic error, so I patched that > branch as well. > > > diff --git a/Src/prompt.c b/Src/prompt.c > index 9ed6c54..0cc9ef9 100644 > --- a/Src/prompt.c > +++ b/Src/prompt.c > @@ -1316,12 +1316,11 @@ prompttrunc(int arg, int truncchar, int doprint, > int endchar, > */ > for (;;) { > *ptr++ = *fulltextptr; > - if (*fulltextptr == Outpar || > - *fulltextptr == '\0') > + if (*fulltextptr == '\0' || > + *fulltextptr++ == Outpar) > break; > - if (*fulltextptr == Nularg) > + if (fulltextptr[-1] == Nularg) > remw--; > - fulltextptr++; > } > } else { > #ifdef MULTIBYTE_SUPPORT > @@ -1397,12 +1396,11 @@ prompttrunc(int arg, int truncchar, int doprint, > int endchar, > if (*skiptext == Inpar) { > /* see comment on left truncation above */ > for (;;) { > - if (*skiptext == Outpar || > - *skiptext == '\0') > + if (*skiptext == '\0' || > + *skiptext++ == Outpar) > break; > - if (*skiptext == Nularg) > + if (skiptext[-1] == Nularg) > maxwidth--; > - skiptext++; > } > } else { > #ifdef MULTIBYTE_SUPPORT > -- Joel D. Elkins --047d7b86c92e67008e0504204a60--