about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2003-01-27 16:39:25 +0000
committerBart Schaefer <barts@users.sourceforge.net>2003-01-27 16:39:25 +0000
commit6c78ce042d4f56e60faf380c8312310cb03906ea (patch)
treea3b2426dabecfa1c98a82e0ef4a09fe42b1d3280 /Src
parent8f67d52d72b219a04632eccff758579430d5161a (diff)
downloadzsh-6c78ce042d4f56e60faf380c8312310cb03906ea.tar.gz
zsh-6c78ce042d4f56e60faf380c8312310cb03906ea.tar.xz
zsh-6c78ce042d4f56e60faf380c8312310cb03906ea.zip
18144: allow %{ %} to put bounds around a prompt truncation.
Diffstat (limited to 'Src')
-rw-r--r--Src/prompt.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index 762daf2c1..ac96ad340 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -93,6 +93,10 @@ static int trunclen;
 
 static int dontcount;
 
+/* Level of %{ / %} surrounding a truncation segment. */
+
+static int trunccount;
+
 /* Strings to use for %r and %R (for the spelling prompt). */
 
 static char *rstring, *Rstring;
@@ -465,6 +469,8 @@ putpromptchar(int doprint, int endchar)
 		}
 		break;
 	    case /*{*/ '}':
+		if (trunccount && trunccount >= dontcount)
+		    return *fm;
 		if (dontcount && !--dontcount) {
 		    addbufspc(1);
 		    *bp++ = Outpar;
@@ -868,7 +874,9 @@ prompttrunc(int arg, int truncchar, int doprint, int endchar)
 	bp = ptr;
 	w = bp - buf;
 	fm++;
+	trunccount = dontcount;
 	putpromptchar(doprint, endchar);
+	trunccount = 0;
 	ptr = buf + w;		/* putpromptchar() may have realloc()'d */
 	*bp = '\0';