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

Highlighted cursor position breaks after surrogate pairs #199

Open
dzaima opened this issue Nov 2, 2022 · 1 comment
Open

Highlighted cursor position breaks after surrogate pairs #199

dzaima opened this issue Nov 2, 2022 · 1 comment

Comments

@dzaima
Copy link

dzaima commented Nov 2, 2022

As can be seen in https://asciinema.org/a/AxH57hTJctdztmBaJ2bBTS7nP, characters, which in JavaScript are represented as surrogate pairs, break cursor highlight positioning, due to the position being calculated in terms of JavaScript characters, not Unicode codepoints.

One possible fix is available here; in my testing, that makes such surrogate pair characters work perfectly. (feel free to pull that commit directly to main, modify/copy as needed, or request a PR)

This fix is largely independent of the larger problem around grapheme clusters/wcwidth, but it doesn't make it worse (or, in fact, even makes the cursor be positioned correctly, but that doesn't really mean much if the VT output itself is broken).

@ku1ik
Copy link
Contributor

ku1ik commented Apr 8, 2023

Thanks. This is useful 👍 I'll keep it open until we solve wcwidth-related core problem, and will revisit this then.

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