zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: UNICODE Private Use Area characters in BUFFER
Date: Mon, 24 Oct 2022 00:42:27 +0200	[thread overview]
Message-ID: <CAHYJk3Qi+DEGBYZvwXrqehzjbHHunnVfx6dhJB7hJpjM9GWHiQ@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMoLQBt8ST7E3EachnLra05ENPOiY0nDOC0Z_=a=8Mg4SA@mail.gmail.com>

On 10/23/22, Roman Perepelitsa <roman.perepelitsa@gmail.com> wrote:
> On Sun, Oct 23, 2022 at 6:29 PM Mikael Magnusson <mikachu@gmail.com> wrote:
>>
>> > Note: Private Use Area characters work fine everywhere else. For
>> > example,
>> > in PS1.
>>
>> I'm not sure we have any choice, we have to know how wide every
>> character we print is, and presumably there is no defined width for
>> them as the characters themselves are not defined.
>
> All terminals by default display characters from Private Use Area as
> narrow.

There is no reason to assume this to be the case though, since it is
explicitly unstandardized.

> Zsh also (correctly) treats them as narrow. For example, you
> can do this:
>
>     PS1=$'\uE0B0 '
>
> Whether your terminal can render this glyph or not, everything will
> work fine. The character will take one column and zsh will know that.

Whether or not the terminal uses 0, 1 or 2 spaces for the printed
character, it is okay that we print them assuming it uses 1 space,
since the user has access to the %{%}%G mechanisms to adjust for it in
prompts, this is not possible in the interactive buffer obviously.

> A few more tests to show that Private Use Area characters work find in
> zsh with the exception that you cannot put then in BUFFER:
>
>     % x=$'\uE0B0'
>
>     % print -r -- ${(m)#x}
>     1
>
>     % print -r -- ${${(%):-$x%1(l.at least 1 column.)}[2,-1]}
>     at least 1 column
>
>     % print -r --  ${${(%):-$x%2(l..less than 2 columns)}[2,-1]}
>     less than 2 columns

I or anyone else can make a terminal that does something else with
these codepoints. (I'm just pointing this out).

-- 
Mikael Magnusson


  parent reply	other threads:[~2022-10-23 22:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-23 10:12 Roman Perepelitsa
2022-10-23 16:29 ` Mikael Magnusson
2022-10-23 16:43   ` Roman Perepelitsa
2022-10-23 17:02     ` Bart Schaefer
2022-10-23 17:29       ` Roman Perepelitsa
2022-10-23 18:30         ` Unicode9 (was Re: UNICODE Private Use Area characters in BUFFER) Bart Schaefer
2022-10-23 19:30           ` Roman Perepelitsa
2022-10-23 21:57           ` Mikael Magnusson
2022-10-23 18:54         ` UNICODE Private Use Area characters in BUFFER Bart Schaefer
2022-10-23 19:26           ` Roman Perepelitsa
2022-11-04  9:55         ` Jun T
2022-10-23 22:42     ` Mikael Magnusson [this message]
2022-10-23 23:16       ` Roman Perepelitsa
2022-10-23 23:35         ` Bart Schaefer
2022-10-23 23:46           ` Bart Schaefer
2022-10-24  1:27             ` Mikael Magnusson
2022-10-24  1:43               ` Bart Schaefer
2022-10-24 10:50                 ` Roman Perepelitsa
2022-11-04 10:31                   ` Jun T
2022-11-04 10:33                     ` Roman Perepelitsa
2022-11-04 11:06                       ` Jun T
2022-11-04 11:09                         ` Roman Perepelitsa
2022-11-04 15:32                           ` Jun T

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=CAHYJk3Qi+DEGBYZvwXrqehzjbHHunnVfx6dhJB7hJpjM9GWHiQ@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=roman.perepelitsa@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).