Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
sticky-note and prompt color leftovers (Re: PATCH: broader support for highlight groups)
- X-seq: zsh-workers 52857
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh workers <zsh-workers@xxxxxxx>
- Subject: sticky-note and prompt color leftovers (Re: PATCH: broader support for highlight groups)
- Date: Sat, 30 Mar 2024 02:06:41 +0100
- Archived-at: <https://zsh.org/workers/52857>
- In-reply-to: <CAH+w=7b3SZG+orcExWjGm0mTGRBJtYLW2obNC1Pe-HcMN6oUXg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <90949-1709342493.093890@W3fn.AXo8.ESGa> <CAH+w=7b3SZG+orcExWjGm0mTGRBJtYLW2obNC1Pe-HcMN6oUXg@mail.gmail.com>
On 1 Mar, Bart Schaefer wrote:
> If you choose to disable bleed-over, please have a look at the way
> Functions/Misc/sticky-note applies its background coloring and adjust
> if necessary? I've never really spent any time understanding
> zle_highlight, and although "vared" has options to set the prompts any
> highlighting would (I think?) have to be done in the line-init and
> line-finish widgets if the prompts can't bleed?
Firstly, on the subject of sticky-note, had you intended to commit 47563
and/or 48773?
sticky-note uses raw escape sequences so it remains as broken as before.
For someone who does use zle_highlight, they get an initial clear to
end-of-line with the yellow background and then what they configured
applies for entered text. If that doesn't include a background the
yellow sticks around, at least until backspace, Ctrl-L or something
similar is pressed.
It doesn't need much more than to precede the vared with, e.g.
local zle_highlight=( default:fg=black,bg=yellow )
Passing -p "%F{black}%K{yellow}" also works but I noticed one key
difference to the old bleed-over of raw escapes which is that they
aren't used for the initial clear to end-of-line sequence. I've attached
a patch which rectifies this but I won't be applying this as-is.
Backspace leaves default colours behind it - zsh is printing spaces
over erased characters. And this change also applies to clear to
end-of-display which I find a bit much.
I know that when I worked on this a year ago, I had it in mind to add
an additional key for zle_highlight which is used for line clearing
allowing a background for the area on the right that doesn't contain
text. I can't remember whether or not it was discussed. Any thoughts on
the name - viewport, buffer, field?
Limiting it to lines that contain text where we currently clear to end
of display might be tricky. Though that might please the person who
complained about that overwriting text they were randomly printing below
the cursor.
Oliver
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index f076bdd61..3f48e30dd 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -600,7 +600,8 @@ unset_region_highlight(Param pm, int exp)
static void
tcoutclear(int cap)
{
- cleartextattributes(0);
+ treplaceattrs(prompt_attr);
+ applytextattributes(0);
tcout(cap);
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author