Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[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

Closed
alekitto wants to merge2 commits intosymfony:2.7fromalekitto:fix_progress_bar

Conversation

@alekitto
Copy link
Contributor

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?maybe
Deprecations?no
Tests pass?yes
Fixed tickets#16957
LicenseMIT
Doc PR

Rewrittenoverwrite 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 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

@fabpot
Copy link
Member

👍

1 similar comment
@xabbuh
Copy link
Member

👍

@javiereguiluz
Copy link
Member

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
Copy link
ContributorAuthor

We can write them as class constants, but what do you think about implementing a class to build escape sequences?

@fabpot
Copy link
Member

@alekitto Probably a very good idea but out of the scope of this PR.

@fabpot
Copy link
Member

Thank you@alekitto.

fabpot added a commit that referenced this pull requestApr 14, 2016
…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
@fabpotfabpot closed thisApr 14, 2016
@alekitto
Copy link
ContributorAuthor

@fabpot Great! I'll open a new PR against the master branch for the escape sequences builder

@javiereguiluz
Copy link
Member

@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!

This was referencedApr 29, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@alekitto@fabpot@xabbuh@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp