-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Add ability to also recognize colons in ANSI escapes #167
Conversation
for more information, see https://pre-commit.ci
Can you please provide some backing for making this change? After 20+ years of using ANSI that is the first time when I hear about using colons. A quick search on wikipedia. There is a section on 24-bit which mentions as being included in ODA, a commercial failure. https://en.wikipedia.org/wiki/ANSI_escape_code Basically what bug does this fix? |
See issue #166 for the full story. |
ansi2html/converter.py
Outdated
params = [ | ||
int(item) | ||
for subitem in [x.split(":") for x in params.split(";")] | ||
for item in subitem | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems to be way more complex than ideal and necessary. Would this approach work?:
In [7]: [int(v) for v in re.split("[:;]", "111;222:333;444")]
Out[7]: [111, 222, 333, 444]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. I keep forgetting that re.split()
exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaysonlarose if you could simplify the code using re.split
, I would consider it ready to merge. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaysonlarose thank you! 👍
This basically just treats colons and semicolons as exactly the same when it comes to parsing ANSI.
Fixes: #166