Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] Fix table cell styling #22217

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

Merged
merged 1 commit into from
Mar 31, 2017
Merged

[Console] Fix table cell styling #22217

merged 1 commit into from
Mar 31, 2017

Conversation

ro0NL
Copy link
Contributor

@ro0NL ro0NL commented Mar 29, 2017

Q A
Branch? 2.7
Bug fix? yes
New feature? tiny one
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...

Fixes an issue with newlines and table cells. Remembered this little trick from @chalasr as we had it before with style blocks i believe..

$table = new Table($output);
$table->setRows(array(
    array(new TableCell('<error>Dont break'."\n".'here</error>', array('colspan' => 2))),
    new TableSeparator(),
    array('foo', new TableCell('<error>Dont break'."\n".'here</error>', array('rowspan' => 2))),
    array('bar'),
));
$table->render();

Before

image

After

image

@chalasr
Copy link
Member

chalasr commented Mar 29, 2017

👍 nice catch

Status: reviewed

@ro0NL
Copy link
Contributor Author

ro0NL commented Mar 29, 2017

applies to rowspan as well.. looking at it.

@ro0NL
Copy link
Contributor Author

ro0NL commented Mar 29, 2017

too bad.. the trick doesnt seem to work in that case

ie this one still fails;

$table = new Table($output);
$table->setRow(0, array(new TableCell('f<error>o'."\n".'o</error>o', array('rowspan' => 2)), 'a'));
$table->setRow(1, array('b'));
$table->render();

edit: the same trick does work at first sight.. but breaks tests (e.g. Cell with rowspan and colspan contains new line break).

edit2: all good now :)

@chalasr
Copy link
Member

chalasr commented Mar 29, 2017

Status: needs review
then :)

@ro0NL
Copy link
Contributor Author

ro0NL commented Mar 29, 2017

Agree. Had to add a tiny new feature as well.

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Member

@stof stof left a comment

Choose a reason for hiding this comment

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

👍

@stof
Copy link
Member

stof commented Mar 30, 2017

Status: Reviewed

@fabpot
Copy link
Member

fabpot commented Mar 31, 2017

Thank you @ro0NL.

@fabpot fabpot merged commit 53ecf83 into symfony:2.7 Mar 31, 2017
fabpot added a commit that referenced this pull request Mar 31, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix table cell styling

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | tiny one
| BC breaks?    | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

Fixes an issue with newlines and table cells. Remembered this little trick from @chalasr as we had it before with style blocks i believe..

```php
$table = new Table($output);
$table->setRows(array(
    array(new TableCell('<error>Dont break'."\n".'here</error>', array('colspan' => 2))),
    new TableSeparator(),
    array('foo', new TableCell('<error>Dont break'."\n".'here</error>', array('rowspan' => 2))),
    array('bar'),
));
$table->render();
```

Before

![image](https://cloud.githubusercontent.com/assets/1047696/24467857/74dacc9e-14b6-11e7-8f62-3831508ac949.png)

After

![image](https://cloud.githubusercontent.com/assets/1047696/24467923/bb578f0e-14b6-11e7-85ed-039cd73b81a0.png)

Commits
-------

53ecf83 [Console] Fix table cell styling
@ro0NL ro0NL deleted the console/style branch March 31, 2017 14:40
@fabpot fabpot mentioned this pull request Apr 4, 2017
@chalasr
Copy link
Member

chalasr commented Apr 4, 2017

@ro0NL It looks like merging this up to master broken tests with high deps, see e.g. https://travis-ci.org/symfony/symfony/jobs/218357015#L2631. Maybe the merge went wrong?

@ro0NL
Copy link
Contributor Author

ro0NL commented Apr 4, 2017

@chalasr I think this PR went fine.. looking at your travis result it looks like #22188 is causing the failure...

Not sure what's going on.. ill have a look asap.

@chalasr
Copy link
Member

chalasr commented Apr 4, 2017

I do think the descriptors failures are related to this one though :/ (frameworkbundle, see https://ci.appveyor.com/project/fabpot/symfony/build/1.0.20617#L598). Quite hard to fix for me right now

@ro0NL
Copy link
Contributor Author

ro0NL commented Apr 4, 2017

👍 gonna have a look at it asap. For now im clueless about the failure...

-| Options      | compiler_class: Symfony\Component\Routing\RouteCompiler |
-|              | opt1: val1                                              |
-|              | opt2: val2                                              |
+| Options      | compiler_class: Symfony\Component\Routing\RouteCompiler |
+|              | opt1: val1                                              |
+|              | opt2: val2                                              |

Seems whitespace related.. not sure :)

@chalasr
Copy link
Member

chalasr commented Apr 4, 2017

Break-line and/or whitespaces, pretty sure :)
Thank you for looking into!

Broken from 2.8 btw

@ro0NL
Copy link
Contributor Author

ro0NL commented Apr 4, 2017

OK.. figured it out. The thing is we're replacing "\n" with "<fg=default;bg=default>\n</>".

In above example (the route options) contain 2 new lines.. meaning with this replacement the fixture changes as well. Visually you dont see it :)

Will prepare a PR for 2.8 👍

@chalasr
Copy link
Member

chalasr commented Apr 4, 2017

You rock!

@ro0NL
Copy link
Contributor Author

ro0NL commented Apr 4, 2017

See #22278

fabpot added a commit that referenced this pull request Apr 4, 2017
This PR was squashed before being merged into the 3.2 branch (closes #22270).

Discussion
----------

[Console] Fix render exception test

| Q             | A
| ------------- | ---
| Branch?       | 3.2 and up
| Bug fix?      | yes (regression from #22188 in master)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22217 (comment)
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

As pointed out by @chalasr tests are mysteriously broken.. not sure what i missed but this is apparently needed now..

cc @fabpot

Commits
-------

6b71722 [Console] Fix render exception test
chalasr pushed a commit to chalasr/symfony that referenced this pull request Apr 4, 2017
nicolas-grekas added a commit that referenced this pull request Apr 4, 2017
…ro0NL)

This PR was squashed before being merged into the 2.8 branch (closes #22278).

Discussion
----------

[FrameworkBundle] Update console fixtures after #22217

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes (regression from #22217)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22217 (comment)
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

cc @fabpot

Sorry for the inconvenience :)

Commits
-------

6e1cee6 [FrameworkBundle] Update console fixtures after #22217
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Apr 4, 2017
…ro0NL)

This PR was squashed before being merged into the 2.8 branch (closes #22278).

Discussion
----------

[FrameworkBundle] Update console fixtures after #22217

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes (regression from #22217)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#22217 (comment)
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

cc @fabpot

Sorry for the inconvenience :)

Commits
-------

6e1cee6 [FrameworkBundle] Update console fixtures after #22217
nicolas-grekas added a commit that referenced this pull request Apr 4, 2017
* 2.8:
  [FrameworkBundle] Update console fixtures after #22217
nicolas-grekas added a commit that referenced this pull request Apr 4, 2017
* 3.2:
  [FrameworkBundle] Update console fixtures after #22217
  Allow Upper Case property names
  fix some risky tests
  bumped Symfony version to 2.7.27
  updated VERSION for 2.7.26
  update CONTRIBUTORS for 2.7.26
  updated CHANGELOG for 2.7.26
This was referenced Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants