Homec4science

Ignore colors and formatting when determining string length.

Authored by Joshua Spence <josh@joshuaspence.com> on Jun 17 2014, 17:59.

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
{F167511}

After
{F167512}

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

Details

Committed
Joshua Spence <josh@joshuaspence.com>Jun 17 2014, 17:59
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU7f78f3e8ff7b: Add a method to `PhutilConsoleTable` to hide the header.
Branches
Unknown
Tags
Unknown

Event Timeline

Joshua Spence <josh@joshuaspence.com> committed rPHU68f970cae19f: Ignore colors and formatting when determining string length. (authored by Joshua Spence <josh@joshuaspence.com>).Jun 17 2014, 17:59