diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2014-10-08 01:29:12 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2014-10-08 01:29:12 +0200 |
commit | 1c3f90e3af0c3d6c8e946653169287baf5814ad4 (patch) | |
tree | 9b15e9ad8157bd8f9f697f6dc4e59146b6833c59 /Src/prompt.c | |
parent | 1ffb184b46edd34d389af4e016abcaafec454d44 (diff) | |
parent | 9982ab6fb5266298c056326ed265fc8560202603 (diff) | |
download | zsh-1c3f90e3af0c3d6c8e946653169287baf5814ad4.tar.gz zsh-1c3f90e3af0c3d6c8e946653169287baf5814ad4.zip |
Merge commit '9982ab6fb5266298c056326ed265fc8560202603' into debian
This is exactly one commit after the zsh-5.0.7 and adds one missing
(and not unimportant) changelog entry for the 5.0.7 release.
Diffstat (limited to 'Src/prompt.c')
-rw-r--r-- | Src/prompt.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/Src/prompt.c b/Src/prompt.c index 328ae3c66..0cc9ef917 100644 --- a/Src/prompt.c +++ b/Src/prompt.c @@ -372,6 +372,17 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep) if (t0 >= arg) test = 1; break; + case 'e': + { + Funcstack fsptr = funcstack; + test = arg; + while (fsptr && test > 0) { + test--; + fsptr = fsptr->prev; + } + test = !test; + } + break; case 'L': if (shlvl >= arg) test = 1; @@ -786,6 +797,19 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep) if(bv->Rstring) stradd(bv->Rstring); break; + case 'e': + { + int depth = 0; + Funcstack fsptr = funcstack; + while (fsptr) { + depth++; + fsptr = fsptr->prev; + } + addbufspc(DIGBUFSIZE); + sprintf(bv->bp, "%d", depth); + bv->bp += strlen(bv->bp); + break; + } case 'I': if (funcstack && funcstack->tp != FS_SOURCE && !IN_EVAL_TRAP()) { @@ -1292,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 @@ -1373,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 |