-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
Fullwidth unicode characters should be accounted for in print width #260
Labels
Milestone
Comments
belav
changed the title
Implement GetPrintedWidth() to properly handle special characters.
Fullwidth unicode characters should be accounted for in width
Feb 4, 2023
belav
changed the title
Fullwidth unicode characters should be accounted for in width
Fullwidth unicode characters should be accounted for in print width
Feb 4, 2023
belav
added a commit
that referenced
this issue
Apr 20, 2024
belav
added a commit
that referenced
this issue
May 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unicode characters can be fullwidth, which takes the same space as two normal characters. This isn't taken into account when printing right now. A method was abstracted away to /Src/CSharpier/Utilities/StringExtensions.cs that can be modified to implement this feature.
See https://github.com/prettier/prettier/blob/main/src/utils/get-string-width.js for how prettier does it.
There doesn't seem to be much about this that I can find in c#/.net
https://stackoverflow.com/questions/65410411/how-to-reliably-determine-the-width-of-a-character-in-c
The text was updated successfully, but these errors were encountered: