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
- X-seq: zsh-workers 48343
- From: Marlon Richert <marlon.richert@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: region_highlight converts `fg=default` to `none`, which is not the same
- Date: Wed, 31 Mar 2021 11:24:04 +0300
- Archived-at: <https://zsh.org/workers/48343>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-03/CAHLkEDu_KrURVgtqLCPtppHZkPj8xOpRoK8EEYMo239EhwT3vQ%40mail.gmail.com>
- In-reply-to: <CAN=4vMq1CjLKiwM0_HWfQf5=xLTGQ7z9mVs=QEsCp05suLK-fA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAHLkEDv9ch+nhtpYF3So+029J6GMv5iU-8=RzHRHLa7OYzc3kg@mail.gmail.com> <CAN=4vMq1CjLKiwM0_HWfQf5=xLTGQ7z9mVs=QEsCp05suLK-fA@mail.gmail.com>
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