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

lolcat should be ansi control character aware #27

Closed
kestred opened this issue Nov 10, 2013 · 3 comments
Closed

lolcat should be ansi control character aware #27

kestred opened this issue Nov 10, 2013 · 3 comments

Comments

@kestred
Copy link

kestred commented Nov 10, 2013

When coloring terminal output that uses control characters, the control characters are interrupted by the color codes. The proper behavior would be that the ANSI control code is not colored, and lolcat skips to the next printable character.

A good test case for this behavior is using lolcat with sl (steam locomotive).
Try sl | lolcat in your preferred shell.

Bonus Points:
If the coloring was seeded based on character position, instead of incremental color changes, (ie. doing coloring statelessly) then coloring could be consistent within a single execution of the program. It would of course be ideal to have the coloring randomly seeded per execution so the effect continues to stay novel.

@NicolaeNMV
Copy link

I'm trying to colorate man's output, but it doesn't work very well.
I see repeting letters

man -P "lolcat -f | less -r" man

result is this, repeating characters:

http://i.imgur.com/frZ4iJE.png

"NNAAMMEE
man - format and display the on-line manual pages

SSYYNNOOPPSSIISS
mmaann
"
Could the cause be that lolcat is not "ansi control character" aware ?

@m-o-e
Copy link
Member

m-o-e commented Mar 30, 2014

lolcat actually is ANSI color aware, which you can verify by piping lolcat to itself: base64 </dev/urandom | lolcat -f | lolcat

However, it only strips ANSI color codes and leaves all other ANSI sequences (such as cursor positioning commands) untouched.

If you can come up with a nice way to improve this then a pull request would be welcome.

@m-o-e
Copy link
Member

m-o-e commented Sep 11, 2015

closing after >1 year of inactivity

@m-o-e m-o-e closed this as completed Sep 11, 2015
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

No branches or pull requests

3 participants