From 6502d05897a7d9441fcabfd24f203cffe4da59aa Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 9 Feb 2023 00:10:19 +0100 Subject: [PATCH] 51320, 51383: fixes to prevent later reappearance of old attributes Also associated test updates and a test fix for TERM=dumb. --- ChangeLog | 7 +++++++ Src/Zle/complist.c | 2 ++ Src/Zle/zle_main.c | 2 +- Src/Zle/zle_tricky.c | 2 ++ Test/D01prompt.ztst | 2 +- Test/X04zlehighlight.ztst | 2 +- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e63157de..bbe45a3f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-02-09 Oliver Kiddle + + * 51320, 51383: Src/Zle/zle_main.c, Src/Zle/complist.c, + Src/Zle/zle_tricky.c, Test/D01prompt.ztst, + Test/X04zlehighlight.ztst: fixes to prevent later reappearance + of old attributes + 2023-02-06 Peter Stephenson * 51350: Src/subst.c, Test/D04parameter.ztst: the combination diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index 8bdf1bb29..9cb89a60d 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -1305,6 +1305,8 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop) } } if (dopr) { + treplaceattrs(0); + applytextattributes(0); if (!(cc % zterm_columns)) fputs(" \010", shout); cleareol(); diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index cfa0a739d..4a6c02133 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -2071,9 +2071,9 @@ trashzle(void) trashedzle = 1; zrefresh(); showinglist = sl; - moveto(nlnct, 0); treplaceattrs(prompt_attr); applytextattributes(0); + moveto(nlnct, 0); if (clearflag && tccan(TCCLEAREOD)) { tcout(TCCLEAREOD); clearflag = listshown = 0; diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index f94bfce3c..07fac7144 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -2560,6 +2560,8 @@ printfmt(char *fmt, int n, int dopr, int doesc) } } if (dopr) { + treplaceattrs(0); + applytextattributes(0); if (!(cc % zterm_columns)) fputs(" \010", shout); if (tccan(TCCLEAREOL)) diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst index a0abb7e1d..55861cca1 100644 --- a/Test/D01prompt.ztst +++ b/Test/D01prompt.ztst @@ -261,7 +261,7 @@ A1=${(%):-%s} A2=${(%):-%u} A3=${(%):-%s%u%s} - [[ $A3 = $A1$A2 && -n $A1 && -n $A2 ]] + [[ $A3 = $A1$A2 ]] 0:Attribute optimisation - preserve initial disabling of attribute but drop useless later one : ${(%):-%K{blue}} diff --git a/Test/X04zlehighlight.ztst b/Test/X04zlehighlight.ztst index 296635bf5..87a59fde5 100644 --- a/Test/X04zlehighlight.ztst +++ b/Test/X04zlehighlight.ztst @@ -40,7 +40,7 @@ # Fix e^Mexit - match ((?)\r(?)), if \2 == \3, then replace with \2 # otherwise replace with \1 stripped out of leading/trailing [[:space:]] REPLY=${REPLY//(#b)((?(#c0,1))$cm(?(#c0,1)))/${${${(M)match[2]:#${match[3]}}:+${match[2]}}:-${${match[1]##[[:space:]]##}%%[[:space:]]##}}} - [[ -n "$REPLY" ]] && print -r -- ${${REPLY%%[[:space:]]##}##[[:space:]]##} + [[ -n "$REPLY" ]] && print -r -- ${${REPLY%%${~cm}*}##[[:space:]]##} done } zpty_stop() {