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

Add support for calculating display width of chars and strings #11038

Open
straight-shoota opened this issue Jul 29, 2021 · 1 comment
Open

Comments

@straight-shoota
Copy link
Member

straight-shoota commented Jul 29, 2021

Unicode characters can have different widths. Typical western characters are halfwidth, while some eastern scripts have fullwidth characters (which are twice as wide). To calculate the display width of a character or string, it is paramount to take these character widths into consideration.

A Crystal implementation is already available as a shard in https://github.com/naqvis/uni_char_width
It would be great to include this in the standard library because it's universally useful and we have a use case in the compiler (formatter): #11034

@crysbot
Copy link
Collaborator

crysbot commented May 5, 2024

This issue has been mentioned on Crystal Forum. There might be relevant details there:

https://forum.crystal-lang.org/t/print-change-string-size-if-it-take-more-than-one-line/6813/3

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

No branches or pull requests

2 participants