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

Fullwidth unicode characters should be accounted for in print width #260

Closed
belav opened this issue Jun 2, 2021 · 0 comments · Fixed by #1237
Closed

Fullwidth unicode characters should be accounted for in print width #260

belav opened this issue Jun 2, 2021 · 0 comments · Fixed by #1237
Labels
priority:low type:enhancement New feature or request
Milestone

Comments

@belav
Copy link
Owner

belav commented Jun 2, 2021

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

@belav belav added the type:enhancement New feature or request label Jun 2, 2021
@belav belav changed the title Implement GetPrintedWidth() to properly handle special characters. Fullwidth unicode characters should be accounted for in width Feb 4, 2023
@belav 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 belav added this to the 0.29.0 milestone Apr 20, 2024
belav added a commit that referenced this issue Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:low type:enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant