Closed
Description
As in the title, the Console TableHelper doesn't ignore style tags / color codes when calculating a cell's width, which causes misaligned table borders.
To reproduce, create a table using the TableHelper class and style one or more of the cells. I've put the base table code in a Gist.
This ends up creating tables that look like this:
+-------+-----------+------------------------+
| | Absolute | Percent |
+-------+-----------+------------------------+
| Free | 12.76 GB | 5.48% |
| Total | 232.96 GB | 100.00% |
| Used | 220.2 GB | 94.52% |
+-------+-----------+------------------------+
I tried changing line 431 of the TableHelper class (in the getCellWidth()
function) to include a strip_tags()
call, but even then the table ends up looking like:
+-------+-----------+---------+
| | Absolute | Percent |
+-------+-----------+---------+
| Free | 12.76 GB | 5.48% |
| Total | 232.96 GB | 100.00% |
| Used | 220.2 GB | 94.52% |
+-------+-----------+---------+
And that doesn't fix styles applied with the OutputFormatterStyle->apply()
call.