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

feat(terminal): check ambiguous unicode width #44

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented Jan 26, 2025

Display width of unicode characters can differ based on terminal, font, and language settings.

East asian languages, in grids, and wide chars will display some single width chars as double width for proper alignment in those languages. However seems that Windows by default does this also for other languages.

This PR adds a way to detect if a character is an 'ambiguous width' character, an 'A' classification in https://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt. Though even that doesn't seem to be conclusive, since also the 'N' (neutral) category might be 1 or 2 width.

Seems like the only conclusive way is to print the character and record the change in cursor position. So this code is not a full fix, so leaving it as draft for now.

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

Successfully merging this pull request may close these issues.

1 participant