Skip to content
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] SymfonyStyle: fix block rpadding when escaping '<' #14600

Merged
merged 1 commit into from May 15, 2015
Merged

[Console] SymfonyStyle: fix block rpadding when escaping '<' #14600

merged 1 commit into from May 15, 2015

Conversation

ogizanagi
Copy link
Member

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

screenshot 2015-05-10 a 20 37 46

@jakzal jakzal added the Console label May 12, 2015
@xabbuh
Copy link
Member

xabbuh commented May 12, 2015

The result looks good. Though I don't understand why this is necessary.

@ogizanagi Did you find the cause for this issue?

@ogizanagi
Copy link
Member Author

@xabbuh : AFAIU, it's only due to extra backslashes introduced by the OutputFormatter::escape() method:

return preg_replace('/([^\\\\]?)</is', '$1\\<', $text);

@xabbuh
Copy link
Member

xabbuh commented May 12, 2015

@ogizanagi Indeed, that makes sense.

👍

@aitboudad
Copy link
Contributor

👍

@@ -85,7 +85,7 @@ public function block($messages, $type = null, $style = null, $prefix = ' ', $pa

foreach ($lines as &$line) {
$line = sprintf('%s%s', $prefix, $line);
$line .= str_repeat(' ', $this->lineLength - Helper::strlen($line));
$line .= str_repeat(' ', $this->lineLength - Helper::strlen($line) + substr_count($line, '\<'));
Copy link
Contributor

Choose a reason for hiding this comment

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

would you mind add a comment above that explain the change :) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Should I link this PR as reference in a comment ? comment + link or just link ?

Copy link
Member Author

Choose a reason for hiding this comment

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

https://github.com/symfony/symfony/pull/14600/files#diff-18b76c26b226bea37b2b821a5e4962ffR88

Let me know what comment you expect if you think it's better :)

@nicolas-grekas
Copy link
Member

Thank you @ogizanagi.

@nicolas-grekas nicolas-grekas merged commit 80fc341 into symfony:2.7 May 15, 2015
nicolas-grekas added a commit that referenced this pull request May 15, 2015
…<' (ogizanagi)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] SymfonyStyle: fix block rpadding when escaping '<'

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

![screenshot 2015-05-10 a 20 37 46](https://cloud.githubusercontent.com/assets/2211145/7555745/4dfbfd58-f755-11e4-98c4-3c42bb71abd3.PNG)

Commits
-------

80fc341 [Console] SymfonyStyle: fix block rpadding when escaping '<'
@ogizanagi ogizanagi deleted the sfstyle_fix_rpad branch May 15, 2015 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants