Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: UNICODE Private Use Area characters in BUFFER



On Mon, Oct 24, 2022 at 12:42 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> On 10/23/22, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> >
> > 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.

Sorry, I should've clarified that I'm not making an assumption. I'm
talking about the actual terminals that exist. The fact that all of
them render Private Use Area characters as narrow means that zsh is
doing the right thing by treating them as narrow.

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

This code shows how zsh treats characters from Private Use Area. The
output doesn't depend on or require a terminal. I wanted to show that
zsh handles characters from Private Use Area just fine. The only place
I know of where zsh cannot handle them is BUFFER.

Roman.




Messages sorted by: Reverse Date, Date, Thread, Author