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

Splitting within an ANSI color code causes all output to be printed in that color #147

Open
wfchandler opened this issue Jul 27, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@wfchandler
Copy link
Contributor

Currently ANSI color codes present in source input are retained and printed in the output, even when redirecting to a file.

If a split is made within a color group, this may lead to an unescaped color code that causes all output to use that color.

image

In the log file being parsed the color code starts at the start of the second column and is terminated at the end of third:

image

By parsing the second column as a field we capture the start of the color code, but lose its termination. The stuck terminal color can be fixed by executing echo -e '\033[0m'.

I think it would probably be better to strip out color and other terminal escape codes from output.

@rcoh
Copy link
Owner

rcoh commented Aug 4, 2021

this is an interesting bug...stripping color from the output is probably the best option

@rcoh rcoh added the bug Something isn't working label Aug 4, 2021
@tstack
Copy link
Contributor

tstack commented Aug 18, 2021

The vte crate (https://crates.io/crates/vte) might be useful here. Stripping the escape sequences before putting the string through parsers would probably be something to try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants