Skip to content

terminal: Implement grapheme clustering mode (DECSET 2027) #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks
coletrammer opened this issue Apr 12, 2025 · 1 comment
Closed
3 tasks

terminal: Implement grapheme clustering mode (DECSET 2027) #11

coletrammer opened this issue Apr 12, 2025 · 1 comment
Labels
enhancement New feature or request terminal Related to terminal emulation
Milestone

Comments

@coletrammer
Copy link
Owner

coletrammer commented Apr 12, 2025

Summary

DECSET 2027 allows telling the terminal to perform grapheme clustering on incoming text as opposed to simply taking the wcwidth of each individual code point (wcwidth typically uses the East Asian Width property in the Unicode database). The wcwidth method doesn't work for certain multiple code point emojis (and probably other things).

Neovim supports this since 0.11 so its actually useful to implement.

Supporting this will be awkward for older terminals, because there's on real way to render the text correctly in if the outer terminal doesn't support this. For those cases, we need to forcibly set the cursor after writing the cell. This feature can be supported on at least coutour, ghostty, wezterm (mode 2027 is always on, but we can move the cursor manually when mode 2027 is off), and kitty (via text sizing protocol).

The spec is here: https://github.com/contour-terminal/terminal-unicode-core

Progress

  • Find/write unicode library
  • Use support in Unicode library
  • Add tests
@coletrammer coletrammer added enhancement New feature or request terminal Related to terminal emulation labels Apr 12, 2025
@coletrammer coletrammer added this to the 0.1 milestone Apr 12, 2025
@kovidgoyal
Copy link

You might be interested in: kovidgoyal/kitty#8533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request terminal Related to terminal emulation
Projects
None yet
Development

No branches or pull requests

2 participants