Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: support for italic and faint fonts from region_highlight

On 20 Jan, Mikael Magnusson wrote:
> Tha patch seems to fix my blue problems (but X04 is unhappy). Thanks!

This requires a change to the zpty_line() function which is one of the
functions handling the tests. With the earlier patch, it now clears the
attributes after the first \r. So stripping [[:space:]]## from the end
of REPLY was leaving the \r\e[0m in $REPLY.

Bart wrote:
> In a shell running in an emacs buffer, I get ...

Given that for TERM=dumb it is quite valid for %s and %u to be empty,
the test can't rely on that so I've removed the two -n conditions in the
test. This does slightly limit the scope of what is being tested: I took
care that ${(%):-%s} does give you the disable standout sequence despite
not having turned it on before.

The patch also does some handling for leaving attributes on at the end
of zstyle ':completion:*:descriptions' format
That was possible before but with behaviour that can only be described
as a mess. Turning them off explicitly solves problems.

Sorry for having been slow to address these things.


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);
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 @@
-  [[ $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:]]
-        [[ -n "$REPLY" ]] && print -r -- ${${REPLY%%[[:space:]]##}##[[:space:]]##}
+        [[ -n "$REPLY" ]] && print -r -- ${${REPLY%%${~cm}*}##[[:space:]]##}
     zpty_stop() {

Messages sorted by: Reverse Date, Date, Thread, Author