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

Re: region_highlight converts `fg=default` to `none`, which is not the same



Can someone please review Roman's patch (attached)?

On Tue, Oct 13, 2020 at 2:05 PM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
> On Mon, Oct 12, 2020 at 11:23 AM Marlon Richert
> <marlon.richert@xxxxxxxxx> wrote:
> >  1. It seems incorrect to convert `fg=default` to `none`. From reading the [documentation](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting), `none` is not supposed to be the same as `fg=default`.
>
> I took a quick look at this yesterday. When you print region_highlight
> and "fg=default" comes out as "none", that's a bug in the printing
> logic (function output_highlight in Src/prompt.c). It's fairly easy to
> fix -- patch below (only for fg; bg should be handled similarly).
> Naturally, it doesn't solve the other issues you've described. I
> haven't looked at why the highlight doesn't get applied as it should
> be.
diff --git a/Src/prompt.c b/Src/prompt.c
index 997327e18..36c828321 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -1842,6 +1842,13 @@ output_highlight(zattr atr, char *buf)
 	atrlen += len;
 	if (buf)
 	    ptr += len;
+    } else if (atr & TXTNOFGCOLOUR) {
+	len = 10;
+	atrlen += len;
+	if (buf) {
+	    strcpy(ptr, "fg=default");
+	    ptr += len;
+  }
     }
     if (atr & TXTBGCOLOUR) {
 	if (atrlen) {


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