summaryrefslogtreecommitdiff
path: root/Src/prompt.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2014-08-29 09:46:34 +0100
committerPeter Stephenson <pws@zsh.org>2014-08-29 09:46:34 +0100
commit711e1427b5eb80104b4d6ad1504f43ea958970d8 (patch)
tree2d5fa87c1b07910200310e3db5535cf157583214 /Src/prompt.c
parent40d559d8803ddbfa6d6d628e86491398f543aca3 (diff)
downloadzsh-711e1427b5eb80104b4d6ad1504f43ea958970d8.tar.gz
zsh-711e1427b5eb80104b4d6ad1504f43ea958970d8.zip
33057: %e in prompts shows evaluation / execution depth
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index 328ae3c66..47625351f 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -786,6 +786,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()) {