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

Pass ansi color codes straight through to a curses window? #56

Open
isene opened this issue Oct 21, 2020 · 2 comments
Open

Pass ansi color codes straight through to a curses window? #56

isene opened this issue Oct 21, 2020 · 2 comments

Comments

@isene
Copy link

isene commented Oct 21, 2020

Is there a way to output text to a curses window without curses messing with the ansi color codes - I would like the color codes to simply pass through and let the text be colored in the window. I am perfectly aware of how to color text in curses, but I would rather not go through that roundabout when outputting syntax highlighted text to a curses window (like with the command

curses_window << `batcat --color=always #{file}`

... where batcat is the syntax highlighting cousin to cat (also known as just "bat")

@shugo
Copy link
Member

shugo commented Dec 10, 2020

I don't know whether there is such a feature in ncurses itself.

You can use Kernel#print to output raw escape sequences, but it breaks redisplay by curses.

@isene
Copy link
Author

isene commented Dec 10, 2020

I went to the roundabout way and wrote a parser for all ansi color sequences as part of my project RTFM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants