-
Notifications
You must be signed in to change notification settings - Fork 12
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
Filter out the escape sequences #3
Comments
This is a bug in your version of Almost all programs do this correctly. Try While Shin could strip escapes from the output and it would happen to work in the simple case you posted, in other cases it would fail spectacularly. Not all escape sequences are basic SGR codes controlling formatting attributes. Cursor movement, terminal modes etc., when ignored and stripped out, will lead to corrupt output if the program mistakenly assumes it's running in a TTY. In summary, I'm leaning towards "won't fix" here. This is without question a problem with the program you're running, and it also affects scenarios other than Shin. |
Thanks for your explaination, now I see it's the programs' duty to do the extra works. I'll check if the issue is still persist in newest tldr-python-client and report to them. And thanks for point to the alternative project tealdeer! |
Neofetch has the same issue for me. |
I couldn't believe a tool as popular as Neofetch would have this problem. Don't people ever pipe Neofetch output to a file?!? But indeed, here it is: dylanaraps/neofetch#753 And what's even worse, they "fixed" it by adding an " This sucks so bad. Everything is broken. But reality is real. You've changed my mind. I will implement the workaround of removing SGR escapes in Shin. |
Done. Kindly test whether this fixes the problem with the programs you're using. Note that only SGR escape sequences are removed. This is deliberate. If a program emits other kinds of escape sequences outside of a TTY, there are likely bigger issues than escapes littering the output, and I'd rather not mask those. |
|
So they are using cursor movement escape sequences too. As explained above, I won't be removing those in Shin. Even if I did, the output would still look broken because they are using cursor movement to align the text. This is precisely why stripping out such sequences makes no sense. They are required for the output to work. To quote from the Neofetch issue linked above (emphasis added):
You can try the |
Sounds reasonable to me. Neofetch seems to be not maintained anymore anyway. |
hyfetch is an active fork of neofetch, and the fix to detect the output type has been already merged: hykilpikonna/hyfetch#31, so you can use that forked version instead |
I think it's useful to leave out the escape sequences, because usually text editor will not properly render shell color code anyways.
For example, this is the output of command
tldr ls
The text was updated successfully, but these errors were encountered: