zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: 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 12:14:19 -0700	[thread overview]
Message-ID: <CAH+w=7anCsewUZDMwSzfYsGZW-FQEcHBN2j=zjtG6ODRQVAssQ@mail.gmail.com> (raw)
In-Reply-To: <94987-1711801416.293559@CNCH.O8Et.GLEz>

On Sat, Mar 30, 2024 at 5:23 AM Oliver Kiddle <opk@zsh.org> wrote:
>
> Bart Schaefer wrote:
> > No, but I was planning to commit 52314 if any feedback were provided
>
> 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.

There's no need for backward compatibility at this point, as that has
never gone anywhere except into 52314.  That implementation can be
scrapped and replaced with zle_highlight -compatible constructs.

The more complicated issue is how to apply the highlighting when doing
"list the existing sticky notes", because ZLE is not involved there.
I guess if it's limited to styling the entire note rather than
individual words, I only need the starting and ending %-expandos, if
there's an easy way to extract that from the $zle_highlight value.

> The purpose of the display style might have been easier to follow if
> you had used keys with names like urgent, later, work

I was copying the names originally proposed back in vapnik spaknik's
"Suggested improvement" thread (May 2021).

> [...]  as %s turns off standout, %d or %n may be
> better.

Could also just use a parameter interpolation, e.g. ${.zsticky.note}
... I used %s so that it could be passed to printf but that's not
really necessary, especially if I rewrite with ${|...}.

> I'd also be inclined to make use of the zstyle context, e.g.:
>
>   zstyle ':sticky-note:urgent' display '%H{urgent}<<< %d >>>'

That's complicated when it comes to listing out the possible context
choices for completion in _sticky_displays.  Suggestions?

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

This should be changed to use zstyle -q at the very least.  Hadn't got
there yet.

> 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

If you've entered sticky-display with ^X? then you need one ^M to get
out of that and then two more rapidly to finish the note.  Does that
explain what you see?

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

Presently you can edit an existing note but then that is appended as a
new one.  Editing old notes would have to be done with e.g. "zed -h"
which I haven't integrated yet ... and has other issues because the
history timestamps are used to match up the notes with the display
file.

Otherwise sticky-note has to be completely rewritten to avoid use of
"fc -p" for the notefile, which is not out of the question but makes
up/down "history" of notes complicated.

> Would you want blink?

I would not, but vapnik did, which what got this started.  Could there
e.g. be a zattr bit that means "the next five bytes are a custom
attribute" and then just stuff in the escape sequence directly?  I
suppose that messes with remembering how attributes overlap.

> > 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.

Perhaps a single boolean that says either to extend the background
color to the end of the line vs. reverting to the default terminal at
the end of the printable text, would be sufficient.  The only reason I
can think of for using something different would be to distinguish
trailing whitespace (i.e., where the background shows through but
there's actually something there in $BUFFER).


  reply	other threads:[~2024-03-30 19:15 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
2024-03-30 19:14         ` Bart Schaefer [this message]
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='CAH+w=7anCsewUZDMwSzfYsGZW-FQEcHBN2j=zjtG6ODRQVAssQ@mail.gmail.com' \
    --to=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).