Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ZWJ paste from clipboard problem (unicode)
- X-seq: zsh-users 30238
- From: "Daniil Rozanov" <personal@xxxxxxxxxxxx>
- To: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- Cc: "Zsh users" <zsh-users@xxxxxxx>
- Subject: Re: ZWJ paste from clipboard problem (unicode)
- Date: Tue, 01 Apr 2025 12:08:27 +0400
- Archived-at: <https://zsh.org/users/30238>
- In-reply-to: <CAHYJk3Tg7LL2AwjX0CD=CgM2fOVZuiQd85a3TOAyhPB1h9vABw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <D8UOVIME9HDS.1I0WLZVJ6FPQ7@rozanov.info> <CAH+w=7atQJ9Hqp=MXpin3CMQ=N_=fvhYs1aWfFh2fpHNLbEvzg@mail.gmail.com> <D8URMP63LOAZ.35Q236JMFWTLZ@rozanov.info> <CAHYJk3Tg7LL2AwjX0CD=CgM2fOVZuiQd85a3TOAyhPB1h9vABw@mail.gmail.com>
On Tue Apr 1, 2025 at 5:07 AM +04, Mikael Magnusson wrote:
> On Mon, Mar 31, 2025 at 11:23 PM Daniil Rozanov <personal@xxxxxxxxxxxx> wrote:
>>
>> On Mon Mar 31, 2025 at 11:31 PM +04, Bart Schaefer wrote:
>> > On Mon, Mar 31, 2025 at 12:13 PM Daniil Rozanov <personal@xxxxxxxxxxxx> wrote:
>> >>
>> >> When trying to paste "👩" (U+1F469 U+1F3FB U+200D U+1F9B0) emoji, zsh
>> >> prints two emojis and "<200d>" in between.
>> >
>> > Try "setopt combining_chars"
>> >
>> > Additional tweaks may be needed if your terminal is using bracketed paste mode.
>>
>> Thanks! Now it pastes pretty emoji. But now there is another problem,
>> which is character's width is more than expected. And with some special
>> emojis it works wrong: duplicated display on paste, backspase erases
>> kinda parts of emoji instead of remove it all at once. Btw this
>> behaviour now is similar to bash.
>>
>> Maybe zsh has some group of settings which handle unicode?
>
> What you want is not theoretically possible as far as I know.
> Combining emojis is optional according to the specs, and zsh has no
> way of knowing if a terminal will combine two particular emoji in a
> zwj sequence, and thus has no idea how wide the sequence of characters
> will be or when the terminal will start drawing on a new line.
>
>
> --
> Mikael Magnusson
As far as I know it is possible on some bunch of terminals. This
possibility called "mode 2027", briefly described here:
https://mitchellh.com/writing/grapheme-clusters-in-terminals
So at least zsh can test terminal to know does it support grapheme
clustering or not and work around this.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author