[console][TableCell] get cell width without decoration.

This commit is contained in:
Abdellatif Ait boudad 2015-06-03 10:47:06 +00:00 committed by Fabien Potencier
parent dc296cc951
commit d93b16f407

View File

@ -550,12 +550,13 @@ class Table
{ {
if (isset($row[$column])) { if (isset($row[$column])) {
$cell = $row[$column]; $cell = $row[$column];
$cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
if ($cell instanceof TableCell && $cell->getColspan() > 1) { if ($cell instanceof TableCell && $cell->getColspan() > 1) {
// we assume that cell value will be across more than one column. // we assume that cell value will be across more than one column.
$cell = substr($cell, 0, strlen($cell)/$cell->getColspan()); $cellWidth = $cellWidth / $cell->getColspan();
} }
return Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); return $cellWidth;
} }
return 0; return 0;