Open
Description
Hi Jitendra,
I've discovered a table rendering bug that occurs when using colored/formatted strings. Here's an example with a 2x2
table where values in the last column are in bold:
$rows = [
['Name' => 'Server A', 'Hostname' => '<bold>server-a.example.com</end>'],
['Name' => 'Server B', 'Hostname' => '<bold>server-b.example.com</end>'],
];
$this->app()->io()->writer()->colors((new Table())->render($rows));
The expected output should be:
+----------+----------------------------------+
| Name | Hostname |
+----------+----------------------------------+
| Server A | server-a.example.com |
| Server B | server-b.example.com |
+----------+----------------------------------+
As a result, I get the following:
+----------+----------------------------------+
| Name | Hostname |
+----------+----------------------------------+
| Server A | server-a.example.com |
| Server B | server-b.example.com |
+----------+----------------------------------+
I believe the formatting tags are included in the string length calculation but then removed without being replaced by
trailing white spaces, as the number of missing characters exactly matches strlen('<bold></end>')
.
Kind regards,
Adriano
Metadata
Metadata
Assignees
Labels
No labels