about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2023-01-10 20:53:17 +0100
committerOliver Kiddle <opk@zsh.org>2023-01-10 20:53:17 +0100
commit667ead3a64e590ac758e9f0a053849c7aaccec66 (patch)
tree2ef4d722cc527d11cf81534b27e6af6f5e95c51b /Src/subst.c
parent996b51515600859ce7f952f22c6262ecd24578e1 (diff)
downloadzsh-667ead3a64e590ac758e9f0a053849c7aaccec66.tar.gz
zsh-667ead3a64e590ac758e9f0a053849c7aaccec66.tar.xz
zsh-667ead3a64e590ac758e9f0a053849c7aaccec66.zip
51258, 51272: refactor handling of terminal attributes, removing OFF flags in zattr
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Src/subst.c b/Src/subst.c
index b8e4023e1..897188862 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3716,6 +3716,8 @@ colonsubscript:
     if (presc) {
 	int ops = opts[PROMPTSUBST], opb = opts[PROMPTBANG];
 	int opp = opts[PROMPTPERCENT];
+	zattr savecurrent = txtcurrentattrs;
+	zattr saveunknown = txtunknownattrs;
 
 	if (presc < 2) {
 	    opts[PROMPTPERCENT] = 1;
@@ -3738,7 +3740,8 @@ colonsubscript:
 	    for (; *ap; ap++) {
 		char *tmps;
 		untokenize(*ap);
-		tmps = promptexpand(*ap, 0, NULL, NULL, NULL);
+		txtunknownattrs = TXT_ATTR_ALL;
+		tmps = promptexpand(*ap, 0, NULL, NULL);
 		*ap = dupstring(tmps);
 		free(tmps);
 	    }
@@ -3747,10 +3750,14 @@ colonsubscript:
 	    if (!copied)
 		val = dupstring(val), copied = 1;
 	    untokenize(val);
-	    tmps = promptexpand(val, 0, NULL, NULL, NULL);
+	    txtunknownattrs = TXT_ATTR_ALL;
+	    tmps = promptexpand(val, 0, NULL, NULL);
 	    val = dupstring(tmps);
 	    free(tmps);
 	}
+
+	txtpendingattrs = txtcurrentattrs = savecurrent;
+	txtunknownattrs = saveunknown;
 	opts[PROMPTSUBST] = ops;
 	opts[PROMPTBANG] = opb;
 	opts[PROMPTPERCENT] = opp;