Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bug with %<< prompt expansion
- X-seq: zsh-workers 33256
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: bug with %<< prompt expansion
- Date: Fri, 26 Sep 2014 21:39:49 -0700
- In-reply-to: <CACPkN-ONVBHyFr8nB0j7+bkMBGP8qO25AASHh34gpXE=RwAuCA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CACPkN-ONVBHyFr8nB0j7+bkMBGP8qO25AASHh34gpXE=RwAuCA@mail.gmail.com>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author