You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Symfony version(s) affected: 4.1, probably lower as well
Description
When working on #22225, i noticed something goes wrong with the CLI unset codes as soon a formatted text spans multiple lines, and the output exceeds the window ($LINES), thus when the scrollbar becomes active.
This PR was squashed before being merged into the 4.2-dev branch (closes#28373).
Discussion
----------
[Console] Support max column width in Table
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #22156, #27832
| License | MIT
| Doc PR | symfony/symfony-docs#10300
Continuation of #22225 to better preserve spaces (which preserves background colors), using `wordwrap` it caused some issues.
Also the wrapping was plain wrong by not taking the current line length into account.
While at it, it comes with `Table` integration :)
Given
```php
$table = new Table($output);
$table->setColumnMaxWidth(0, 2);
$table->setRow(0, ['pre <error>foo bar baz</error> post']);
$table->render();
$table = new Table($output);
$table->setColumnMaxWidth(0, 3);
$table->setRow(0, ['pre <error>foo bar baz</error> post']);
$table->render();
$table = new Table($output);
$table->setColumnMaxWidth(0, 4);
$table->setRow(0, ['pre <error>foo bar baz</error> post']);
$table->render();
```

Commits
-------
175f68f [Console] Support max column width in Table
Symfony version(s) affected: 4.1, probably lower as well
Description
When working on #22225, i noticed something goes wrong with the CLI unset codes as soon a formatted text spans multiple lines, and the output exceeds the window (
$LINES
), thus when the scrollbar becomes active.See #22225 (comment)
How to reproduce
My console window ($LINES x $COLUMNS) is set to 12 x 72
I quickly patched the
AboutCommand
as follow:Now running it during 1 session (my scrollbar is invisible here btw 😅)
1st 👍
2nd 👍
3rd 👎
Possible Solution
Not sure, I hope someone can explain what's happening technically.
Additional context
symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
Line 217 in f27c3a8
The text was updated successfully, but these errors were encountered: