summaryrefslogtreecommitdiff
path: root/Src/Zle/zle_main.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2023-01-10 21:02:16 +0100
committerOliver Kiddle <opk@zsh.org>2023-01-10 21:02:16 +0100
commit9d99a01367e85dc3d9cd8e711d78dc1cec6f018b (patch)
tree963e4bbf6710e3401fa22f3dcbe2927599a482e9 /Src/Zle/zle_main.c
parentc01479a2ede78b9b53057322e4b9f5bd0a103a00 (diff)
downloadzsh-9d99a01367e85dc3d9cd8e711d78dc1cec6f018b.tar.gz
zsh-9d99a01367e85dc3d9cd8e711d78dc1cec6f018b.zip
51281: keep track of attributes left on at the end of left and right prompts and reapply them explicitly as appropriate
Diffstat (limited to 'Src/Zle/zle_main.c')
-rw-r--r--Src/Zle/zle_main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 39be33939..686c6f5b4 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1267,11 +1267,13 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
fetchttyinfo = 0;
trashedzle = 0;
raw_lp = lp;
+ txtcurrentattrs = txtpendingattrs = txtunknownattrs = 0;
lpromptbuf = promptexpand(lp ? *lp : NULL, 1, NULL, NULL);
pmpt_attr = txtcurrentattrs;
raw_rp = rp;
rpromptbuf = promptexpand(rp ? *rp : NULL, 1, NULL, NULL);
rpmpt_attr = txtcurrentattrs;
+ prompt_attr = mixattrs(pmpt_attr, rpmpt_attr);
free_prepostdisplay();
zlereadflags = flags;
@@ -2010,6 +2012,7 @@ reexpandprompt(void)
char *new_lprompt, *new_rprompt;
looping = reexpanding;
+ txtcurrentattrs = txtpendingattrs = txtunknownattrs = 0;
new_lprompt = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL);
pmpt_attr = txtcurrentattrs;
free(lpromptbuf);
@@ -2018,9 +2021,9 @@ reexpandprompt(void)
if (looping != reexpanding)
continue;
- rpmpt_attr = pmpt_attr;
new_rprompt = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL);
rpmpt_attr = txtcurrentattrs;
+ prompt_attr = mixattrs(pmpt_attr, rpmpt_attr);
free(rpromptbuf);
rpromptbuf = new_rprompt;
} while (looping != reexpanding);
@@ -2067,6 +2070,8 @@ trashzle(void)
zrefresh();
showinglist = sl;
moveto(nlnct, 0);
+ treplaceattrs(prompt_attr);
+ applytextattributes(0);
if (clearflag && tccan(TCCLEAREOD)) {
tcout(TCCLEAREOD);
clearflag = listshown = 0;