zsh-workers
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Feature request: italic style in region_highlight
Date: Mon, 30 Dec 2019 11:16:53 +0100	[thread overview]
Message-ID: <CAN=4vMpBOD5XJOgjiOWYUJV4QaV2Fn9+PkgTCTMtArJ4GxJA8w@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVC5=SZfY8ExEZ9W2GWa=rYTu545hz9RrE9Uae=MadynSg@mail.gmail.com>

On Mon, Dec 30, 2019 at 2:30 AM Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> Hi,
> it would be nice if the italic escape (\e[3m) would have been
> supported in the region_highlight array. Currently supported are only
> bold, standout and underline. The escape is widely supported, e.g.: it
> works on urxvt out of the box.

Zsh sort of supports italicized text through "standout" attribute in
ncurses. ncurses translates standout to italicized on some terminals
and to negative image on others.

    % zle_highlight=(default:standout)
    % export TERM=screen-256color
    % print -P '%Shello%s'
    hello
    % export TERM=xterm-256color
    % print -P '%Shello%s'
    hello

With TERM=screen-256color standout is italicized while with
TERM=xterm-256color it's negative image.

The terms "italicized" and "negative image" come from ECMA-48. Note
that it doesn't define "standout".

When printing text, you can use `colors` from contrib to bypass
ncurses. Confusingly enough, in `color` associative array the key for
italicized text is "standout" (negative image goes by "reverse").

    % autoload -Uz colors
    % colors
    % echo "\e[$color[standout]mhello$reset_color"

The only difference between $color[standout] and plain `3` is
readability. I know which version I prefer.

As far as I can tell, there is no way to specify italicized attribute
through zle_highlight or region_highlight. zle_highlight allows you to
override the default escape sequences used by fg and bg attributes. It
seems natural to extend this API to also allow overriding escape
sequences used by standout style. Then you would be able to do this:

    zle_highlight=(default:standout standout_begin_code:'\e[3m'
standout_stop_code:'\e[23m')

fg_start_code and fg_end_code specify the prefix and the suffix of a
single escape sequence. To avoid confusion, I've used begin/stop with
standout. It's awkward, as the natural pairing would be start/stop and
begin/end. Oh well.

Roman.

  reply	other threads:[~2019-12-30 10:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30  1:29 Sebastian Gniazdowski
2019-12-30 10:16 ` Roman Perepelitsa [this message]
2019-12-30 16:07   ` Bart Schaefer
2019-12-30 16:26     ` Roman Perepelitsa
2020-01-01  0:07       ` Bart Schaefer
2020-01-02 19:18         ` Oliver Kiddle
2020-01-02 19:45           ` Roman Perepelitsa
2020-01-03  2:30             ` Bart Schaefer
2020-01-03 20:28               ` Daniel Shahaf
2021-05-20 13:33                 ` Marlon Richert
2021-05-25 16:38                   ` Oliver Kiddle
2021-05-25 20:50                     ` Marlon Richert
2021-05-25 20:56                       ` Bart Schaefer
2021-05-27  8:04                         ` Marlon Richert
2021-05-25 17:28                 ` Bart Schaefer
2021-05-25 22:43                   ` Oliver Kiddle

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=4vMpBOD5XJOgjiOWYUJV4QaV2Fn9+PkgTCTMtArJ4GxJA8w@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=sgniazdowski@gmail.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).