zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh workers <zsh-workers@zsh.org>
Subject: sticky-note and prompt color leftovers (Re: PATCH: broader support for highlight groups)
Date: Sat, 30 Mar 2024 02:06:41 +0100	[thread overview]
Message-ID: <65188-1711760801.491883@dElB.g8CB.0-rg> (raw)
In-Reply-To: <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);
 }
 


  reply	other threads:[~2024-03-30  1:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02  1:21 PATCH: broader support for highlight groups Oliver Kiddle
2024-03-02  1:39 ` Bart Schaefer
2024-03-30  1:06   ` Oliver Kiddle [this message]
2024-03-30  3:16     ` sticky-note and prompt color leftovers (Re: PATCH: broader support for highlight groups) Bart Schaefer
2024-03-30 12:23       ` Oliver Kiddle
2024-03-30 19:14         ` Bart Schaefer
2024-03-02  7:57 ` PATCH: broader support for highlight groups Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65188-1711760801.491883@dElB.g8CB.0-rg \
    --to=opk@zsh.org \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).