-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Escape Sequences get partially stripped #182
Comments
Thank you very much for reporting this. |
@eth-p Just in case you have time to look at this: could this be caused by the |
This is a difficult case to handle. The current implementation will only copy the previously-encountered escape sequence, which ends up stripping any others that came before it. And unfortunately, the escape sequence can't just be sent through directly, because the panel/syntax highlighting will end up overriding some of the escape sequences anyways (e.g. color). The only alternatives I can think of are:
For now, I'm going to attempt a hybrid of option 1 and 2 by storing and blindly just copying every encountered SGR sequence before the print, and passing through all non-SGR sequences. |
@sharkdp I made a pull request for a partial (hacky?) fix as described above. Just waiting on the CI build checks to finish. |
Kudos for the quick action you guys took! Is it not possible to actually track the state for at least the text styling sequences (italic, bold etc)? |
Fix released in bat 0.5. |
Command to reproduce:
echo -e '\033[1;3mfoo\033[22m bar\033[23m baz' | bat
.Expected output: foo bar baz
Actual output: foo bar baz
Note that
bar
should be still italic, but it is not when piped through bat. I cannot reproduce this behaviour with other pagers (less, most) or any other shell utility for that matter.The text was updated successfully, but these errors were encountered: