Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:masterfromfancyweb:string-wcswidth
Jan 30, 2020

Conversation

fancyweb
Copy link
Contributor

@fancywebfancyweb commentedJan 1, 2020
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
Tickets-
LicenseMIT
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.

Copy link
Member

@nicolas-grekasnicolas-grekas left a 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

@nicolas-grekasnicolas-grekas changed the title[String] Add the wcswdith() method[String] Made AbstractString::width() follow POSIX.1-2001Jan 13, 2020
@fancywebfancywebforce-pushed thestring-wcswidth branch 4 times, most recently from6ecc13e to495d959CompareJanuary 15, 2020 08:00
@fancyweb
Copy link
ContributorAuthor

@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.

@nicolas-grekas
Copy link
Member

Could we however somehow have a public accessible pure implementation of wcswidth in the String component?

Honestly, I'm not sure until someone gives us a real-world use case... width() looks more useful to me...

@fancywebfancywebforce-pushed thestring-wcswidth branch 3 times, most recently frombd8e0b3 to25b3499CompareJanuary 20, 2020 17:37
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

(with minor comments)

Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
@fabpot
Copy link
Member

Thank you@fancyweb.

fancyweb reacted with hooray emoji

fabpot added a commit that referenced this pull requestJan 30, 2020
…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
@fabpotfabpot merged commit347d825 intosymfony:masterJan 30, 2020
@fancywebfancyweb deleted the string-wcswidth branchJanuary 30, 2020 13:54
@nicolas-grekasnicolas-grekas modified the milestones:next,5.1May 4, 2020
@fabpotfabpot mentioned this pull requestMay 5, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof left review comments

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.1
Development

Successfully merging this pull request may close these issues.

5 participants
@fancyweb@nicolas-grekas@fabpot@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp