diff options
author | jaseg <git@jaseg.de> | 2024-07-04 11:44:47 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2024-07-04 11:45:58 +0200 |
commit | f2c26ed7a72828f94f174ab8c84676856fbe2097 (patch) | |
tree | 27780539d70c0b843ef1434d0d608fb391f11393 /censor.c | |
parent | dc3ddf395017bf903f5bfb8f0c5c6d08d84fcdc0 (diff) | |
download | lolcat-f2c26ed7a72828f94f174ab8c84676856fbe2097.tar.gz lolcat-f2c26ed7a72828f94f174ab8c84676856fbe2097.tar.bz2 lolcat-f2c26ed7a72828f94f174ab8c84676856fbe2097.zip |
Make lolcat interleave nicely with non-colored stderr
This works by making lolcat always reset the color at the end of a line
on its input, and only setting a new color immediately before printing
the first character on the next line. This way, assuming that whatever
process is piped into lolcat follow the standard convention where stdout
is buffered line-wise, and only writes full lines to stderr, a process
that outputs to both stdout and stderr but that has only stdout piped
through lolcat (as most people would do) would have it's stderr output
interleave nicely uncolored with the lolcat-colored stdout output.
This won't always work, but it gets us most of the way there with little
effort and negligible (2 extra escape sequences per line of output)
performance overhead.
Thanks to github user @kolayne for reporting this as an issue!
Diffstat (limited to 'censor.c')
0 files changed, 0 insertions, 0 deletions