Skip to content
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

Emoji and decrqm_unicode #127

Closed
gwenn opened this issue Dec 15, 2024 · 1 comment
Closed

Emoji and decrqm_unicode #127

gwenn opened this issue Dec 15, 2024 · 1 comment

Comments

@gwenn
Copy link

gwenn commented Dec 15, 2024

Hi,
I am trying to solve emoji rendering for rustyline.
And libvaxis seems to use this sequence:

pub const decrqm_unicode = "\x1b[?2027$p";

to check how the current terminal behaves.
So I tried zig build example -Dexample=cli.
But some terminals don't behave correctly.

  • alacritty => OK
    image
  • iterm2 => KO
    image
  • kitty => KO
    image
  • Terminal.app => KO
    image
  • wezterm => OK
    image

Those terminals answer to decrqm_unicode like:

  • alacritty
[27, 91, 63, 50, 48, 50, 55, 59, 48, 36, 121]
[decrpm] 2027 => Some("Mode not recognized"`
  • iterm2
[27, 91, 63, 50, 48, 50, 55, 59, 52, 36, 121]
[decrpm] 2027 => Some("Permanently reset")
  • kitty
[27, 91, 63, 50, 48, 50, 55, 59, 48, 36, 121]
[decrpm] 2027 => Some("Mode not recognized")
  • Terminal.app
    garbage (sequence not supported?)
  • wezterm
[27, 91, 63, 50, 48, 50, 55, 59, 51, 36, 121]
[decrpm] 2027 => Some("Permanently set")

How to check that DECRQM is not supported (by Mac Terminal) ?
How to handle kitty and iterm2 which seem to support grapheme clusters but don't report accordingly ?
Thanks.

@rockorager
Copy link
Owner

Terminal.app

For Terminal.app, there isn't much you can do. I would instead encourage users to use another terminal unfortunately. I will link the best comment I've ever read from notcurses. As the comment suggests, you can check for TERM_PROGRAM=Apple_Terminal

Kitty

Kitty does clustering but doesn't know about ZWJs. The way to calculate widths here is to strip ZWJs and then calculate using standard clustering techniques. I detect kitty in my go library by issuing an XTVERSION query and checking for the presence of "kitty" within the returned string. Kovid has stated he does not want to support mode 2027 style unicode.

iTerm2

I don't use macOS so I haven't tested clustering capabilities on mac. Possibly you could use the XTVERSION query as in kitty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants