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] use ANSI escape sequences in ProgressBar overwrite method#18496
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
fabpot commentedApr 11, 2016
👍 |
1 similar comment
xabbuh commentedApr 14, 2016
👍 |
javiereguiluz commentedApr 14, 2016
ANSI codes are very "unreadable". So, what do you think changing code like this: // Erase the line$this->output->write("\x1B[2K"); By something like this? $eraseLineCode ="\x1B[2K";// ...$this->output->write($eraseLineCode); Or: $ansiCodes =array('eraseLine' =>"\x1B[2K");// ...$this->output->write($ansiCodes['eraseLine']); Maybe in a separate PR? |
alekitto commentedApr 14, 2016
We can write them as class constants, but what do you think about implementing a class to build escape sequences? |
fabpot commentedApr 14, 2016
@alekitto Probably a very good idea but out of the scope of this PR. |
fabpot commentedApr 14, 2016
Thank you@alekitto. |
…te method (alekitto)This PR was squashed before being merged into the 2.7 branch (closes#18496).Discussion----------[Console] use ANSI escape sequences in ProgressBar overwrite method| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | maybe| Deprecations? | no| Tests pass? | yes| Fixed tickets |#16957| License | MIT| Doc PR |Rewritten `overwrite` method in ProgressBar class to use ANSI escape sequences to erase lines.This removes the need to store the last message length as it is not needed to fill the buffer with spaces anymore. As a plus it correctly resets the cursor position while clearing the outputIf the output is not decorated the behavior has not been changed.Could possibly cause a BC break if testing against the decorated emitted output as binary stringCommits-------b6cca4c [Console] use ANSI escape sequences in ProgressBar overwrite method
alekitto commentedApr 14, 2016
@fabpot Great! I'll open a new PR against the master branch for the escape sequences builder |
javiereguiluz commentedApr 14, 2016
@alekitto please before sending a PR, open an issue to discuss about it. A "escape sequence builder" sounds too complex for this simple problem. Thanks! |
Rewritten
overwritemethod in ProgressBar class to use ANSI escape sequences to erase lines.This removes the need to store the last message length as it is not needed to fill the buffer with spaces anymore. As a plus it correctly resets the cursor position while clearing the output
If the output is not decorated the behavior has not been changed.
Could possibly cause a BC break if testing against the decorated emitted output as binary string