atancasis has asked for the wisdom of the Perl Monks concerning the following question:
I need some advice on how to properly handle strings with ANSI color escape sequences (eg: \033[33m) for printing to an ncurses window. Adding such strings to the ncurses window causes the escape sequences to be left intact and be printed out along with the message.
I'm thinking I might have to resort to creating a parser such that upon encountering an escape sequence, corresponding attron()/attroff() calls are made prior to calling printw()/addstr(). However, such an implementation will be inefficient and I'm sure there's a better way to do this.
Any help and guidance would be greatly appreciated. Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Handling ANSI Escape Sequences for Printing to Curses
by GrandFather (Saint) on Jul 31, 2010 at 22:36 UTC | |
by atancasis (Sexton) on Aug 01, 2010 at 00:50 UTC | |
by repellent (Priest) on Aug 01, 2010 at 04:38 UTC | |
by atancasis (Sexton) on Aug 01, 2010 at 05:14 UTC | |
by Khen1950fx (Canon) on Aug 01, 2010 at 04:25 UTC | |
by atancasis (Sexton) on Aug 01, 2010 at 04:44 UTC |