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

Fixes #57, calculate widths correctly when truncating strings with ansi-colors #59

Merged
merged 12 commits into from
Feb 3, 2022

Conversation

njhoffman
Copy link
Contributor

Update truncates string in a way that takes into account ansi color codes.

Existing test/ansi.js did not calculate widths properly because no maxLineWidth given, updated tests truncates line at 21 characters (the largest line width without colors) and compares to ensure color codes do not add to line's calculated width.

Updated test fails with old truncate function, passes with new truncate function, all other tests still pass.

@timoxley timoxley merged commit 1cf9287 into timoxley:master Feb 3, 2022
timoxley added a commit that referenced this pull request Feb 3, 2022
This reverts commit 1cf9287, reversing
changes made to 091ddb0.
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.

None yet

2 participants