I wrote an ANSI terminal emulator decades ago. It's not a small task. Even if you take a small subset of the control codes, there are still some tricky architectural issues to consider w.r.t. how a screen-based console would function within the transcript-based model presented by aplwrap.
If you've seen Dyalog's Linux offering: they've dealt with this by offering a separate mode (and window) for screen-based output. I'd have to give some more thought to this... In the meantime: I'll reiterate Chris's comment about being aware of the TERM environment variable. This, together with shelling out to tput to get terminal-appropriate control codes, can be used to make your program support a wide variety of terminals; not just ANSI-compatible. Of course you'll need to provide a fallback for the case where tput tells you that your terminal doesn't possess the requested capability... Chris: It might be a good idea to pick a glyph other than blank as a substitution character. U+FFFD seems like a good choice: http://en.wikipedia.org/wiki/Specials_%28Unicode_block%29 Re: Bell not working: just a misplaced line: diff --git a/src/txtbuf.c b/src/txtbuf.c index a98cf23..21020b1 100644 --- a/src/txtbuf.c +++ b/src/txtbuf.c @@ -52,8 +52,8 @@ tagged_insert (char *text, ptr = g_utf8_next_char (ptr); if (!g_unichar_isprint (c) && *op != '\n') { gint cl = ptr - op; - for (int i = 0; i < cl; i++) *op++ = ' '; if (*op == '\a') gdk_beep (); + for (int i = 0; i < cl; i++) *op++ = ' '; } } }
