martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.19k stars 260 forks source link

[Feature Request]: Support for Correct Rendering and Cursor Movement of Grapheme Clusters #1194

Open erf opened 4 weeks ago

erf commented 4 weeks ago

What feature would you like to see?

Hello,

I’d like to raise an issue regarding the correct rendering and cursor movement of grapheme clusters or user-perceived characters, such as emojis composed of multiple code points (e.g., ❤️‍🔥🧑‍🧑‍🧒‍🧒).

Currently, it appears that each cell in vis is treated as a single code point, resulting in incorrect rendering of these characters. For example, here is a screenshot of hi👩‍👩‍👦‍👦❤️‍🔥bye in vis:

Screenshot 2024-06-01 at 00 45 06

Here is the output from cat:

Screenshot 2024-06-01 at 00 49 05

And here is a screenshot from my toy editor vid where I've tried to focus on these issues:

Screenshot 2024-06-01 at 01 26 05

Supporting correct rendering and cursor movement of grapheme clusters might require a significant refactor, and I'm not sure if this is a priority or even feasible. However, I believe that modern text editors should support this feature according to the Unicode spec.

This issue is likely related to this old issue, which I have closed in favor of this one.

I understand that larger issues should be discussed on the vis mailing list. However, I would prefer to follow the discussion here on GitHub. I’m not familiar with mailing lists, and I believe GitHub offers a better user experience for discussion, as long as we can keep the conversation civil and positive. 🙏

Thank you for considering this request!