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

Permit ANSI escape codes through unharmed #16

Open
wants to merge 1 commit into
base: <3
Choose a base branch
from

Conversation

gandalf3
Copy link

@gandalf3 gandalf3 commented Nov 5, 2022

Before:
Selection_032
After:
Selection_031

Well, mostly. Doing this correctly would likely require a full implementation of dozens of escape code specifications but this hack should cover most cases.

There is room improvement in that pre-existing SGR codes are not stripped out; the codes gay adds just happens to override them. Stripping out exactly the right codes is difficult because multiple attributes can be set in one code, so codes which set, for example, both foreground color and bold/increased intensity would have to be parsed and split apart.

Fixes #11

Well, mostly. Doing this correctly would likely require a full
implementation of dozens of escape code specifications but this hack
should cover most cases.

There is room improvment in that pre-existing SGR codes are not stripped
out; the codes gay adds just happens to override them. Stripping out
exactly the right codes is difficult because multiple attributes can be
set in one code, so codes which set, for example, both foreground color
and bold/increased intensity would have to be parsed and split apart.
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.

Support for colored outputs
1 participant