Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix width calc w/ certain new ANSI escapes #149

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

msabramo
Copy link
Contributor

@msabramo msabramo commented Sep 25, 2021

Fixes width calculations that were off when table contained terminal hyperlink ANSI escape codes, which are some newer kind of ANSI escape codes, supported by some terminals, such as iTerm.

This was accomplished by replacing regexes with use of the strip-ansi module, which presumably has more up-to-date regexes that know how to deal with these newer ANSI escape codes.

$ make test

   100% 16 tests

Fixes: #147

Fixes width calculations that were off when table contained terminal
hyperlink ANSI escape codes, which are some newer kind of ANSI escape
codes, supported by some terminals, such as iTerm.

This was accomplished by replacing regexes with use of the
[strip-ansi](https://www.npmjs.com/package/strip-ansi) module, which
presumably has more up-to-date regexes that know how to deal with these
newer ANSI escape codes.
@chrean
Copy link
Contributor

chrean commented Nov 17, 2021

Solid contribution @msabramo ! Sorry for the late response, I am merging this.

@chrean chrean merged commit 3753678 into Automattic:master Nov 17, 2021
@dmeeks91 dmeeks91 mentioned this pull request Nov 18, 2021
@ljharb
Copy link
Contributor

ljharb commented Dec 6, 2021

I believe this is the breaking change that caused #160.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Width calculations are off when table contains terminal hyperlink control characters
3 participants