From 7cabee52d8132fed31767392540ae67bac36377e Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 27 Sep 2014 09:26:21 -0700 Subject: 33256: fix prompttrunc() counting of %{ %} spans --- ChangeLog | 4 ++++ Src/prompt.c | 14 ++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59789aefc..b89f90015 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-09-27 Barton E. Schaefer + + * 33256: Src/prompt.c: fix prompttrunc() counting of %{ %} spans + 2014-09-26 Peter Stephenson * 33242: Src/parse.c: don't treat tokens immediately following diff --git a/Src/prompt.c b/Src/prompt.c index 9ed6c54d5..0cc9ef917 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 -- cgit 1.4.1