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] Fix bar width with multilines ProgressBar's format#21958

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
maidmaid wants to merge5 commits intosymfony:3.2frommaidmaid:fixprogressbar

Conversation

@maidmaid
Copy link
Contributor

@maidmaidmaidmaid commentedMar 10, 2017
edited by fabpot
Loading

QA
Branch?3.2
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

The bar width is badly recalculated when we use multilines (\n) and bar placeholer (%bar%) in ProgressBar's format. The bar width is reduced because multilines is considered as a big oneline. This PR fixes this.

nicolas-grekas
nicolas-grekas previously approved these changesMar 15, 2017
@nicolas-grekas
Copy link
Member

I guess needs to merged in a lower branch thought

@maidmaid
Copy link
ContributorAuthor

Should I rebase the PR@nicolas-grekas?

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedMar 15, 2017
edited
Loading

If you don't mind, please do, and change the base branch here yes.
Otherwise, we can do that while merging (and target 2.7 isn'it?)

@maidmaid
Copy link
ContributorAuthor

Rebase onto 2.7 has some conflicts. Create a new PR on 2.7 seems a better idea.

@nicolas-grekas
Copy link
Member

OK for me

@maidmaid
Copy link
ContributorAuthor

Fix this onto 2.7 takes more time than expected. Could you merge this PR and later I will create new PR for 2.7?

@fabpot
Copy link
Member

We only merge fixes in the lowest maintained branch (we don't backport fixes).

@maidmaid
Copy link
ContributorAuthor

Ok, so I will create new PR on 2.7 an other time.

@maidmaid
Copy link
ContributorAuthor

In fact, the resizing of ProgressBar appearsfrom 3.2 and not before. So, I propose to rebase on 3.2.

@nicolas-grekas
Copy link
Member

Let's go for 3.2.

$lineLength = Helper::strlenWithoutDecoration($this->output->getFormatter(),$line);
// gets string length for each sub line with multiline format
$linesLength =array_map(function ($subLine) {
return Helper::strlenWithoutDecoration($this->output->getFormatter(),$subLine);

Choose a reason for hiding this comment

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

rtrim($subLine, "\r") to handle "\r\n" line endings

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

AppVeyor tests are broken because of this?

return Helper::strlenWithoutDecoration($this->output->getFormatter(),$subLine);
},explode("\n",$line));

$maxLineLength =max($linesLength);

Choose a reason for hiding this comment

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

I'd suggest renaming maxLineLength to linesWidth

@maidmaidmaidmaid changed the base branch frommaster to3.2March 20, 2017 14:24
@fabpot
Copy link
Member

Apparently, tests are still broken on Windows

@maidmaidmaidmaidforce-pushed thefixprogressbar branch 2 times, most recently from33029b4 to8349d1dCompareMarch 23, 2017 12:00
@maidmaid
Copy link
ContributorAuthor

Need some help to fix tests please.


publicfunctiontestBarWidthWithMultilineFormat()
{
putenv('COLUMNS=10');
Copy link
Member

@stofstofMar 30, 2017
edited
Loading

Choose a reason for hiding this comment

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

this must be reset at the end of the test to avoid affecting other tests (including when the test fails, so usetry/finally)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thank you@stof, I will check that.

@maidmaid
Copy link
ContributorAuthor

Tests are now green :)

@nicolas-grekasnicolas-grekas self-requested a reviewApril 17, 2017 20:01
@maidmaid
Copy link
ContributorAuthor

PR ready.

@fabpot
Copy link
Member

Thank you@maidmaid.

fabpot added a commit that referenced this pull requestApr 25, 2017
…at (maidmaid)This PR was squashed before being merged into the 3.2 branch (closes#21958).Discussion----------[Console] Fix bar width with multilines ProgressBar's format| Q             | A| ------------- | ---| Branch?       | 3.2| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -The bar width is badly recalculated when we use multilines (``\n``) and bar placeholer (``%bar%``) in ProgressBar's format. The bar width is reduced because multilines is considered as a big oneline. This PR fixes this.Commits-------3d58ab5 [Console] Fix bar width with multilines ProgressBar's format
@fabpotfabpot closed thisApr 25, 2017
@maidmaidmaidmaid deleted the fixprogressbar branchApril 25, 2017 15:10
@fabpotfabpot mentioned this pull requestMay 1, 2017
@maidmaidmaidmaid restored the fixprogressbar branchMay 19, 2017 13:48
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@nicolas-grekasnicolas-grekasAwaiting requested review from nicolas-grekas

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

5 participants

@maidmaid@nicolas-grekas@fabpot@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp