diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php
index 904c04b682..289d1a11da 100644
--- a/src/Symfony/Component/Console/Helper/Table.php
+++ b/src/Symfony/Component/Console/Helper/Table.php
@@ -518,7 +518,7 @@ class Table
foreach ($row as $i => $cell) {
if ($cell instanceof TableCell) {
- $textLength = strlen($cell);
+ $textLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
if ($textLength > 0) {
$contentColumns = str_split($cell, ceil($textLength / $cell->getColspan()));
foreach ($contentColumns as $position => $content) {
diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
index a691405c6b..583777b3ca 100644
--- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php
@@ -35,9 +35,9 @@ class TableTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider testRenderProvider
*/
- public function testRender($headers, $rows, $style, $expected)
+ public function testRender($headers, $rows, $style, $expected, $decorated = false)
{
- $table = new Table($output = $this->getOutputStream());
+ $table = new Table($output = $this->getOutputStream($decorated));
$table
->setHeaders($headers)
->setRows($rows)
@@ -51,9 +51,9 @@ class TableTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider testRenderProvider
*/
- public function testRenderAddRows($headers, $rows, $style, $expected)
+ public function testRenderAddRows($headers, $rows, $style, $expected, $decorated = false)
{
- $table = new Table($output = $this->getOutputStream());
+ $table = new Table($output = $this->getOutputStream($decorated));
$table
->setHeaders($headers)
->addRows($rows)
@@ -67,9 +67,9 @@ class TableTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider testRenderProvider
*/
- public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected)
+ public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $decorated = false)
{
- $table = new Table($output = $this->getOutputStream());
+ $table = new Table($output = $this->getOutputStream($decorated));
$table
->setHeaders($headers)
->setStyle($style)
@@ -485,6 +485,35 @@ TABLE
TABLE
),
+ 'Coslpan and table cells with comment style' => array(
+ array(
+ new TableCell('