-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Fix linewraps in OutputFormatter
#51223
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
[Console] Fix linewraps in OutputFormatter
#51223
Conversation
Hey! Thanks for your PR. You are targeting branch "6.4" but it seems your PR description refers to branch "5.4,". Cheers! Carsonbot |
ec4b7af
to
dd95114
Compare
dd95114
to
c52f972
Compare
e4d46f7
to
31dc48d
Compare
80-902734-1-6 And Then There Were None Agatha Christie | ||
|
||
TABLE | ||
implode("\n", [ |
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.
This change is only because of the line "trim_trailing_whitespace = true" in .editorconfig.
=============== ========================== ================== | ||
|
||
TABLE | ||
implode("\n", [ |
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.
This change is only because of the line "trim_trailing_whitespace = true" in .editorconfig.
31dc48d
to
4d44010
Compare
4d44010
to
fcf86b3
Compare
$this->assertSame("pre \nfoo\nbar\nbaz \npost", $formatter->formatAndWrap('pre <error>foo bar baz</error> post', 4)); | ||
$this->assertSame("pre f\noo\nbar\nbaz p\nost", $formatter->formatAndWrap('pre <error>foo bar baz</error> post', 5)); | ||
$this->assertSame("Â rèälly\nlöng tîtlè\nthät cöüld\nnèêd\nmúltîplê\nlínès", $formatter->formatAndWrap('Â rèälly löng tîtlè thät cöüld nèêd múltîplê línès', 10)); | ||
$this->assertSame("Â rèälly\nlöng tîtlè\nthät cöüld\nnèêd\nmúltîplê\n línès", $formatter->formatAndWrap("Â rèälly löng tîtlè thät cöüld nèêd múltîplê\n línès", 10)); |
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.
Are all these changes on purpose and behave as expected?
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.
Yes, @nicolas-grekas (see comment) had the idea to use wordwrap from the string component for that. Wordwrap works a bit different with the line breaks than the regex before. now it breaks the line not in a word (or only if a word is longer than the full allowed length).
Example:
"Too long li\nne" => "Too long\nline"
IMHO this makes the output more readable.
Thank you @maxbeckers. |
[](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [symfony/console](https://symfony.com) ([source](https://togithub.com/symfony/console)) | require | patch | `6.3.2` -> `6.3.4` | | [symfony/process](https://symfony.com) ([source](https://togithub.com/symfony/process)) | require | patch | `6.3.2` -> `6.3.4` | --- ### Release Notes <details> <summary>symfony/console (symfony/console)</summary> ### [`v6.3.4`](https://togithub.com/symfony/console/releases/tag/v6.3.4) [Compare Source](https://togithub.com/symfony/console/compare/v6.3.2...v6.3.4) **Changelog** (symfony/console@v6.3.3...v6.3.4) - bug [symfony/symfony#51378](https://togithub.com/symfony/symfony/issues/51378) \[Console] avoid multiple new line when message already ends with a new line in section output ([@​joelwurtz](https://togithub.com/joelwurtz)) - bug [symfony/symfony#51223](https://togithub.com/symfony/symfony/issues/51223) \[Console] Fix linewraps in `OutputFormatter` (@​maxbeckers) - bug [symfony/symfony#51355](https://togithub.com/symfony/symfony/issues/51355) \[Console] fix section output when multiples section with max height ([@​joelwurtz](https://togithub.com/joelwurtz)) </details> <details> <summary>symfony/process (symfony/process)</summary> ### [`v6.3.4`](https://togithub.com/symfony/process/compare/v6.3.2...v6.3.4) [Compare Source](https://togithub.com/symfony/process/compare/v6.3.2...v6.3.4) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Lendable/composer-license-checker). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi41Ni4wIiwidXBkYXRlZEluVmVyIjoiMzYuNTYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Fix output for tables with linebreaks and special chars;
Before
After