diff options
author | Barton E. Schaefer <schaefer@zsh.org> | 2014-09-27 09:26:21 -0700 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2014-09-27 09:26:21 -0700 |
commit | 7cabee52d8132fed31767392540ae67bac36377e (patch) | |
tree | 23b3745a3bc4f9ef6e69c4a06651e58a7e098cdc /Src/prompt.c | |
parent | d19d9c1eff7dfe341c8412e310015919ef7729d7 (diff) | |
download | zsh-7cabee52d8132fed31767392540ae67bac36377e.tar.gz zsh-7cabee52d8132fed31767392540ae67bac36377e.tar.xz zsh-7cabee52d8132fed31767392540ae67bac36377e.zip |
33256: fix prompttrunc() counting of %{ %} spans
Diffstat (limited to 'Src/prompt.c')
-rw-r--r-- | Src/prompt.c | 14 |
1 files changed, 6 insertions, 8 deletions
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 |