-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Formatting breaks on new line #19172
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
Comments
Hi @ro0NL. Do you get this output by calling I think the issue would always happen when using |
It only happens on |
Hi, I checked it last night.. and this can get really complex :-) My thoughts so far;-
Another solution could be to capture all string offsets for tags, remove them, wrap etc., recalculate offsets and replace/format them manually afterwards. Or match broken tags after wrapping and before formatting, ie
|
To clearify, i removed formatting at
However escaping kicks in first. |
Not sure but, even if it calls
Hmm. Did you tried something based on this one or another alternative you listed? |
Also the formatting logic is tight to a concrete formatter, ie we cannot fix this without changing its api. Ie. it needs to be fixed via |
We effectively have some work to do for nested tags in Actually if I comment out the escaping line, calling this: $io->block('Lorem <comment> ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</comment>', null, 'fg=black;bg=green'); Leads to
IMHO the problem is too specific to |
My main concern is we create a performance killer when doing it in multiple steps. For instance I still think it belongs on the formatter and/or formatter-style side, from a OO pov. I.e. |
Actually, commenting out the escaping line and calling this: $io->block('Lorem <comment> ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</comment>', null, 'fg=black;bg=green'); Leads to
IMHO the problem is too specific to Output formatting becomes a real headache here. IMHO the SymfonyStyle should primary stay a set of utility methods providing an easy way to have formatted blocks based on a fixed style. Let's wait for the opinion of maintainers. |
This PR was merged into the 2.8 branch. Discussion ---------- [Console] Fix formatting of SymfonyStyle::comment() | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #19172 | License | MIT | Doc PR | n/a This: ```php $io->comment('Lorem ipsum dolor sit amet, consectetur adipisicing elit, <comment>sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat </comment>cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'); ``` Before outputs:  After:  This moves the lines-cutting logic from `block()` into a specific `createBlock`, used from both `comment()` and `block()`, sort as `comment()` can take messages containing nested tags and outputs a correctly formatted block without escaping tags. Commits ------- 0a53e1d [Console] Fix formatting of SymfonyStyle::comment()
Uh oh!
There was an error while loading. Please reload this page.
Hi,
Formatting seems to break on new lines.
//
on the last line should be whiteThe text was updated successfully, but these errors were encountered: