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

Appearance settings

[Console] SymfonyStyle : fix blocks wordwrapping #14739

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

Merged
merged 1 commit into from
Jun 9, 2015
Merged

[Console] SymfonyStyle : fix blocks wordwrapping #14739

merged 1 commit into from
Jun 9, 2015

Conversation

ogizanagi
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Allow to print strings with a length greater than the terminal length in a block by allowing to cut words.
Indeed, currently such code won't work:

//Terminal is 80 chars wide
$sfStyle->caution(str_repeat('#', 78)); //Caution uses 3 chars as prefix (' ! ')

[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: str_repeat(): Second argument has to be greater than
or equal to 0

Of course, this is only a foolish example. But there is no reason the command should fail when trying to output a long word (as we could imagine it could be a FQCN, absolute path or anything else), nor just because the terminal width is too small.

@fabpot
Copy link
Member

fabpot commented Jun 8, 2015

Can you add a unit test for this?

Allow to print strings with a length greater than the terminal length in a block by allowing to cut words.
@ogizanagi
Copy link
Contributor Author

Test added.

@fabpot
Copy link
Member

fabpot commented Jun 9, 2015

Thank you @ogizanagi.

@fabpot fabpot merged commit 58f2fad into symfony:2.7 Jun 9, 2015
fabpot added a commit that referenced this pull request Jun 9, 2015
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] SymfonyStyle : fix blocks wordwrapping

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Allow to print strings with a length greater than the terminal length in a block by allowing to cut words.
Indeed, currently such code won't work:

```php
//Terminal is 80 chars wide
$sfStyle->caution(str_repeat('#', 78)); //Caution uses 3 chars as prefix (' ! ')
```

> [Symfony\Component\Debug\Exception\ContextErrorException]
  Warning: str_repeat(): Second argument has to be greater than
  or equal to 0

Of course, this is only a foolish example. But there is no reason the command should fail when trying to output a long word (as we could imagine it could be a FQCN, absolute path or anything else), nor just because the terminal width is too small.

Commits
-------

58f2fad [Console] SymfonyStyle : Fix blocks wordwrapping
@ogizanagi ogizanagi deleted the sfstyle/fix_wrapping branch June 9, 2015 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.