Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[String] Made AbstractString::width() follow POSIX.1-2001#35156
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
a7fa164
to3c6e292
CompareThere 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.
Thanks, that looks good to me.
I pushed a second commit that makes the most important changes I think we should do.
Namely, we don't want to add a new method, but to improve the existing one.
That's why I madewcwidth()
private, and use it inwidth()
.
Of course, I didn't finish the refacto so tests won't pass anymore :P
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
6ecc13e
to495d959
CompareUh oh!
There was an error while loading.Please reload this page.
@nicolas-grekas Could we however somehow have a public accessible pure implementation of wcswidth in the String component? With moving the wcswidth() method logic somewhere else for example. Symfony wcswidth implementation could become the most robust tested PHP implementation. |
Honestly, I'm not sure until someone gives us a real-world use case... width() looks more useful to me... |
bd8e0b3
to25b3499
CompareThere 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.
(with minor comments)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
Thank you@fancyweb. |
…001 (fancyweb)This PR was merged into the 5.1-dev branch.Discussion----------[String] Made AbstractString::width() follow POSIX.1-2001| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -This PR ports the wcswidth() function (seehttp://man7.org/linux/man-pages/man3/wcwidth.3.html andhttps://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c) into the String component. This new method will be useful in the Console component to determine how many columns a character takes.I kind of copied the Intl data import strategy.Commits-------347d825 [String] Made AbstractString::width() follow POSIX.1-2001
Uh oh!
There was an error while loading.Please reload this page.
This PR ports the wcswidth() function (seehttp://man7.org/linux/man-pages/man3/wcwidth.3.html andhttps://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c) into the String component. This new method will be useful in the Console component to determine how many columns a character takes.
I kind of copied the Intl data import strategy.