zsh-workers
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Bart Schaefer <schaefer@brasslantern.com>,
	Daniel Shahaf <d.s@daniel.shahaf.name>,
	 Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: region_highlight converts `fg=default` to `none`, which is not the same
Date: Fri, 23 Oct 2020 13:38:11 +0200	[thread overview]
Message-ID: <CAN=4vMoUZExCRW4u=+D_LPgQBf4HoLFmDiwTaUepbHdJN3qQKw@mail.gmail.com> (raw)
In-Reply-To: <CAHLkEDs_jT3A8833MkO6r6rOB=3Rshi-hqDcshXSY8EBs6sy-Q@mail.gmail.com>

On Fri, Oct 23, 2020 at 12:40 PM Marlon Richert
<marlon.richert@gmail.com> wrote:
>
> On Fri, 23 Oct 2020 at 12:35, Roman Perepelitsa <roman.perepelitsa@gmail.com> wrote:
>>
>> The only way to know whether the terminal supports some capability
>> (e.g., moving the cursor to the specified location on the screen, or
>> highlighting text with 256 colors) and to use the said capability is
>> through terminfo. There is no way around it.
>
> Sure, but that is not necessary for this particular problem.

Which problem? As I mentioned, it's definitely possible to add support
for italicized text to zsh and to make it consistent with the existing
highlighting API.

The fact that region_highlight and zle_highlight support "standout" is
not a problem but a feature. Standout is a part of the curses standard
and zsh interprets it within region_highlight and zle_highlight in a
manner consistent with the standard. ("standout" within "colors" is a
different matter. That one is incorrect in my opinion.)

> If the user wants to pass something to their own terminal, then
> just let them. Zsh already lets the user pass in ECMA-48 SGR
> parameter values directly in [...] prompt expansions.

Do you mean %{...%}? It's indeed useful and allows the user to insert
any byte sequence into their prompt. I don't think there is anything
specific to ECMA-48 SGR in prompt expansions, or am I missing it?

region_highlight doesn't need the equivalent of %{...%} because it's
implied. So something like this could work:

  region_highlight=($'1 2 raw=\e[4m')

The value of `raw=` spans until the end of the string, so if you want
to combine it with `fg=42`, you'll need to use `fg=42,raw=\e[4m`
rather than `raw=\e[4m,fg=42`. That's one way to do it -- I'm not
particularly attached to it, just thinking out loud.

One tricky part about this is that it doesn't allow you to specify the
sequence that undoes the effect of `raw` but this is probably OK
because zle inserts SGR0 before every that may have different
highlighting. There is something in the code that suggests this isn't
always the case but I don't know where this code actually triggers.

From the implementation's point of view this will require quite a bit
of work because this doesn't fit the existing framework around zattr.

Roman.


  reply	other threads:[~2020-10-23 11:38 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12  9:22 Marlon Richert
2020-10-13 11:05 ` Roman Perepelitsa
2020-10-14  5:12   ` Marlon Richert
2020-10-14 20:46   ` Daniel Shahaf
2020-10-15  7:37     ` Roman Perepelitsa
2020-10-15 16:58       ` Marlon Richert
2020-10-15 17:09         ` Roman Perepelitsa
2020-10-16 13:36           ` Daniel Shahaf
2020-10-24  1:34           ` Oliver Kiddle
2020-10-24  6:42             ` Roman Perepelitsa
2020-10-16 13:28       ` Daniel Shahaf
2020-10-16 15:50         ` Bart Schaefer
2020-10-22 19:58           ` Marlon Richert
2020-10-22 23:28             ` Daniel Shahaf
2020-10-23  8:08             ` Roman Perepelitsa
2020-10-23  9:24               ` Marlon Richert
2020-10-23  9:35                 ` Roman Perepelitsa
2020-10-23 10:40                   ` Marlon Richert
2020-10-23 11:38                     ` Roman Perepelitsa [this message]
2020-10-24  0:50                       ` Functions/Misc/colors vs. region_highlight Bart Schaefer
2020-11-03 18:54                         ` Marlon Richert
2020-11-03 23:45                           ` Bart Schaefer
2020-11-04 15:47                             ` Marlon Richert
2021-04-18 21:40                         ` Bart Schaefer
2020-10-23 23:57                   ` Threading across year boundaries (was: Re: region_highlight converts `fg=default` to `none`, which is not the same) Daniel Shahaf
2021-03-31  8:26       ` region_highlight converts `fg=default` to `none`, which is not the same Marlon Richert
2021-04-10 20:33         ` Lawrence Velázquez
2021-04-13 15:20           ` Daniel Shahaf
2021-04-13 20:33             ` Roman Perepelitsa
2021-04-14 11:04               ` Daniel Shahaf
2021-05-09 20:49                 ` Lawrence Velázquez
2021-05-31  1:16                   ` Lawrence Velázquez
2021-03-31  8:24   ` Marlon Richert

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='CAN=4vMoUZExCRW4u=+D_LPgQBf4HoLFmDiwTaUepbHdJN3qQKw@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=marlon.richert@gmail.com \
    --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).