Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Console] TableHelper doesn't ignore style tags / codes when calculating column width #8152

Copy link
Copy link
Closed
@ciarand

Description

@ciarand
Issue body actions

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.