Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Console] Upgrade word wrapping in SymfonyStyle#30519
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The original word wrapping method got sometimes ugly outputs because of formatter tags: <comment>, <info>, etc. The new solution skips these tags from the line lengths.
ro0NL commentedMar 11, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
can you provide some code / console output that lead to this fix? I tend to believe it's a new feature instead, where we would preserve raw formatting. Not sure createBlock() should try that, as it's not really supported to use nested markup here (given the block itself uses markup); or at least is interpreted as raw text. cc@chalasr |
fchris82 commentedMar 11, 2019
Hello@ro0NL ,
I have a command with longer and detailed help texts with many colored words or signs to be readable, eg: The output was really ugly sometimes because of many "hidden" formatter tags, the length of lines were very changing.
I changed only the original |
ro0NL commentedMar 11, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
createBlock() is private and has an escape flag, i assume you either use e.g. ive added formatted text wrapping in#22225, perhaps we can use it here? and render the result as-is (OUTPUT_RAW), sounds more simple :D for the case with escaping, e.g. |
fchris82 commentedMar 12, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Is there anybody who knows what the problem could be here?https://travis-ci.org/symfony/symfony/jobs/504759370 I can see that one test is failed, but it should be good, it works fine at me and on 7.2 also. It looks like that
I looked at this, and yes, it could be good. As I can see I should refactor everywhere the <?php// test.php$string ='őúáű';$simple =strlen($string);$mb =mb_strlen($string);printf("String: %s\nSimple: %d\nMB: %d",$string,$simple,$mb); # PHP 5.6$ docker run --rm --volume$PWD:/app --workdir /app php:5.6-cli php test.phpString: őúáűSimple: 8MB: 4# PHP 7.2$ docker run --rm --volume$PWD:/app --workdir /app php:7.2-cli php test.phpString: őúáűSimple: 8MB: 4 |
ro0NL commentedMar 12, 2019
for the UTF related issue, would it be better to create a separate PR?
based on the amount of code here (and a new feature (breaking tags) of which im not sure we need it) i would prefer that route. |
fchris82 commentedMar 12, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Yes, I agree with this.
It isn't clear exactly for me. Which route do you prefer? |
ro0NL commentedMar 12, 2019
using I think even we dont need to change the OUTPUT_ type, using OUTPUT_NORMAL will preserve existing formatted text i expect. |
fchris82 commentedMar 12, 2019
OK, but it is only available from |
fchris82 commentedMar 12, 2019
@ro0NL Oh, I have just seen that the It could be OK in shorter place (<30 chars, eg: table cell), but it isn't same what I made. |
ro0NL commentedMar 12, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
i think we should first focus on correct rendering (not breaking visual output). Then later on we can try to patch formatAndWrap to be more clever concerning 'word breaks' (but never exceed the max width; so worst case we would still chop up words, or more clever with a dash |
Uh oh!
There was an error while loading.Please reload this page.
The original word wrapping method got sometimes ugly outputs because of formatter tags:
<comment>,<info>, etc. The new solution skips these tags from the line lengths, and usesmb_*()functions to handle strings/words.