-
Notifications
You must be signed in to change notification settings - Fork 581
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(console): add unicodeWidth for TTY text layout #3297
Conversation
fe9d454
to
e3795a5
Compare
I'm -1 on this PR as I don't believe it's worth the added complexity of a Rust implementation. We recently deprecated the Rust implementation of I'm also unsure whether this functionality is sought after enough to be in the Standard Library. I don't feel strongly about this, though. That's not to say such functionality would be valuable in a 3rd party module! 🙂 |
To clarify, this is a TypeScript port of a Rust crate, not a WASM implementation. The Rust code is just a thin wrapper around the crate, used for checking equivalency of results during testing, and isn't imported by the module code itself. |
|
We prefer |
23234b9
to
5a6e221
Compare
The implementation looks good to me. |
It's bikeshedding topic, but I'm wondering between 2 api name candidates: |
FWIW, while I don't think the name |
I've done a bit of pondering (my original response before I cut it down to this was ~half a page long), but I think that |
I'm in favor of keeping
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for your contribution @lionel-rowe
Also thanks all for discussions and reviews
Closes #3296.
A TypeScript port of the unicode-width Rust crate, which looks up the nominal width of Unicode characters. This allows calculating the expected physical column width of a string in TTY-like environments when combined with
stripColor
fromfmt/colors.ts
.