Repository navigation
ansi: strip SGR sequences with colon-separated parameters - #310
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
strip_ansi_codes(and someasure_text_width,truncate_str,pad_str) only accepts;between CSI parameters. SGR sequences that use the colon form from ITU T.416, like curly underline\x1b[4:3mor\x1b[38:2::255:128:0m, are cut off after the first number and the rest leaks into the text:This lets the parser take
:wherever it takes;, and makes the same change in the reference regex the DFA tests compare against (plus:in the exhaustive small-strings test).The new
strip_sgr_with_colon_separated_paramstest fails on main withleft: ":3mwavy :2::255:128:0morange".make test,make lintandmake format-checkpass.