Question

My program read some text data from network, something like: Hello \033[1;34mworld\033[0m and bla bla bla!!!\n". When program output this string using prinf, the word "world" is blue. But when I'm using ncurses interface with wprintw or addch, I see the original string with escape sequences. Does it mean that printf handle escape sequences or not? What is the best way handle escape sequences with ncurses?

Was it helpful?

Solution

No, your terminal handles the escape sequences. The phenomenon you're seeing comes from the fact that ncurses' whole purpose is to keep track of the intended terminal contents and be able to repaint it, and as part of doing this it strips any escape sequences. It might provide an alternative function to interpret them and apply them to its own image of what the terminal should contain, but otherwise you'll have to do this job yourself...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top