Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: UNICODE Private Use Area characters in BUFFER
- X-seq: zsh-workers 50811
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: UNICODE Private Use Area characters in BUFFER
- Date: Sun, 23 Oct 2022 18:43:54 +0200
- Archived-at: <https://zsh.org/workers/50811>
- In-reply-to: <CAHYJk3SWfX7ZaFA=WgDBtSPZD0isV5OUHWgf3ienhzhzK+9xQw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAN=4vMowyKmrQtQb=QTxiVzQJXRubz-o2T12=6aQBHSpkKwOig@mail.gmail.com> <CAHYJk3SWfX7ZaFA=WgDBtSPZD0isV5OUHWgf3ienhzhzK+9xQw@mail.gmail.com>
On Sun, Oct 23, 2022 at 6:29 PM Mikael Magnusson <mikachu@xxxxxxxxx> 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. 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.
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
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author