1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-07 19:16:57 +01:00

33256: fix prompttrunc() counting of %{ %} spans

This commit is contained in:
Barton E. Schaefer 2014-09-27 09:26:21 -07:00
parent d19d9c1eff
commit 7cabee52d8
2 changed files with 10 additions and 8 deletions

View file

@ -1,3 +1,7 @@
2014-09-27 Barton E. Schaefer <schaefer@zsh.org>
* 33256: Src/prompt.c: fix prompttrunc() counting of %{ %} spans
2014-09-26 Peter Stephenson <p.stephenson@samsung.com>
* 33242: Src/parse.c: don't treat tokens immediately following

View file

@ -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