zsh-workers
 help / color / mirror / code / Atom feed
From: Joel Elkins <joel@elkins.co>
To: zsh-workers@zsh.org
Subject: Re: bug with %<< prompt expansion
Date: Sun, 28 Sep 2014 08:40:17 -0500	[thread overview]
Message-ID: <CACPkN-OvyOeOeRn+mqy4qzCXd4_1TgvsK11GBWWuSFwVk_HQWQ@mail.gmail.com> (raw)
In-Reply-To: <140926213949.ZM6043@torch.brasslantern.com>

[-- Attachment #1: Type: text/plain, Size: 2352 bytes --]

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 <schaefer@brasslantern.com>
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

      reply	other threads:[~2014-09-28 13:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26 23:27 Joel Elkins
2014-09-27  4:39 ` Bart Schaefer
2014-09-28 13:40   ` Joel Elkins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACPkN-OvyOeOeRn+mqy4qzCXd4_1TgvsK11GBWWuSFwVk_HQWQ@mail.gmail.com \
    --to=joel@elkins.co \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).