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: Re: sticky-note and prompt color leftovers (Re: PATCH: broader support for highlight groups)
Date: Sat, 30 Mar 2024 13:23:36 +0100	[thread overview]
Message-ID: <94987-1711801416.293559@CNCH.O8Et.GLEz> (raw)
In-Reply-To: <CAH+w=7bOrAn9s+sk-R_-aJZvpRyxmWFDejzuu6K5Zree4Xx2og@mail.gmail.com>

Bart Schaefer wrote:
> No, but I was planning to commit 52314 if any feedback were provided
> (which none has been, so far).  So please have a look a that, if you
> don't mind.

From the perspective of display attributes, that change would make it
significantly harder to adapt to using zle_highlight instead of the
colors function if you also need to maintain backward compatibility with
user style settings. In it's current form, with the associative array,
fg/bg can be mapped directly to fg= and bg= except where they have
values like bright-gray. The reset key could be ignored and the color
key would a problem.

The purpose of the display style might have been easier to follow if
you had used keys with names like urgent, later, work rather than none,
blink, reverse in the example. With the %s substitution form, prompt
strings would be more consistent with how we configure other things like
completion descriptons. And as %s turns off standout, %d or %n may be
better. I'd also be inclined to make use of the zstyle context, e.g.:

  zstyle ':sticky-note:urgent' display '%H{urgent}<<< %d >>>'

I don't personally like the existing approach of defining a style for
the fallback default. sticky-note currently does this for theme.

The recursive-edit doesn't seem to work too well, at least not starting
with my setup. I somehow need to Ctrl-C out of it. Might be related to
that ^M^M binding which is somehow hard to trigger despite KEYTIMEOUT
being generous enough. But if it works for you including with bindkey -v
then I probably need to bisect my setup.

Is there a way to remove or edit an existing note?

> > It doesn't need much more than to precede the vared with, e.g.
> >   local zle_highlight=( default:fg=black,bg=yellow )

Some of the other keys like paste, ellipsis and region may also be
applicable too.

> OK.  What about effects like underlining or blinking?

zle_highlight=( default:fg=black,bg=yellow,underline )

Would you want blink? Adding that to zle in the manner of italic and
faint would now be really easy but I didn't want to be too profligate
with the bits in zattr that got freed up in the refactoring. And my
normal terminal dropped support for blink at some point.

But given that terminals are now providing custom true-colour double
curly underline, we might have to find a way to remove the restrictions.

> > 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?
>
> I don't recall discussion either.  How (if at all) does the PREDISPLAY
> / POSTDISPLAY text fit into this?  Would the fallback case be to match
> the bg= color or to use the terminal default background?

The background color would equally apply to those. There's no way for
widgets to control the cleared space and PREDISPLAY/POSTDISPLAY are
mostly used by widgets. This leads me to the conclusion that we would
instead need an extra key - clear, or clearbg, perhaps - so that you
would instead do:

  zle_highlight=( default:clear=yellow )

This doesn't need extra bits in zattr but would need an extra zattr for
each zle_highlight entry. I fear it would require consuming memory on a
colour for every position in the zle buffer. Perhaps, we need to think
about keeping indices into a palette instead. Maybe we can limit it to
default for now.

Oliver


  reply	other threads:[~2024-03-30 12:23 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   ` sticky-note and prompt color leftovers (Re: PATCH: broader support for highlight groups) Oliver Kiddle
2024-03-30  3:16     ` Bart Schaefer
2024-03-30 12:23       ` Oliver Kiddle [this message]
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=94987-1711801416.293559@CNCH.O8Et.GLEz \
    --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).