HomePhabricator

Ignore colors and formatting when determining string length.

Description

Ignore colors and formatting when determining string length.

Summary:
When calculating the length of a string with phutil_utf8_console_strlen, escape codes shouldn't contribute any width to the string.

This change allows for the widths of a PhutilConsoleTable table to be determined correctly when using rows containing formatting and/or colors.

Test Plan:
Before

Before (99×495 px, 10 KB)

After

After (97×372 px, 10 KB)

Reviewers: epriestley, Blessed Reviewers

Reviewed By: epriestley, Blessed Reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9597

Details

Provenance
joshuaspenceAuthored on
joshuaspencePushed on Jun 17 2014, 3:59 PM
Reviewer
Blessed Reviewers
Differential Revision
D9597: Ignore colors and formatting when determining string length.
Parents
rPHU7f78f3e8ff7b: Add a method to `PhutilConsoleTable` to hide the header.
Branches
Unknown
Tags
Unknown

Event Timeline