diff options
author | james <> | 2008-02-24 00:42:53 +0000 |
---|---|---|
committer | james <> | 2008-02-24 00:42:53 +0000 |
commit | 3240b828391da405d093356eae0b90af5abc7a32 (patch) | |
tree | f4dff70c3bc9ca1da2d855fe512571ff4a6ea29d /src/ansi.c | |
parent | 667353b64b552aff9e785a20ee915fb343a0dac9 (diff) | |
download | sympathy-3240b828391da405d093356eae0b90af5abc7a32.tar.gz sympathy-3240b828391da405d093356eae0b90af5abc7a32.tar.bz2 sympathy-3240b828391da405d093356eae0b90af5abc7a32.zip |
*** empty log message ***
Diffstat (limited to 'src/ansi.c')
-rw-r--r-- | src/ansi.c | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.30 2008/02/24 00:42:53 james + * *** empty log message *** + * * Revision 1.29 2008/02/23 11:48:37 james * *** empty log message *** * @@ -316,21 +319,30 @@ ansi_set_attr (ANSI * a, int attr) } +static void +ansi_emit_noutf8 (TTY * t, uint32_t ch) +{ + uint8_t c = (ch > 0x7f) ? '?' : ch; + t->xmit (t, &c, 1); +} static void ansi_render (ANSI * a, CRT_CA ca) { int dif; - if (ca.chr < 32) + if (ca.chr < 0x20) ca.chr = ' '; - if (ca.chr > 126) + if ((ca.chr > 0x7e) && (ca.chr < 0xa0)) ca.chr = ' '; ansi_set_attr (a, ca.attr); ansi_set_color (a, ca.color); - a->terminal->xmit (a->terminal, &ca.chr, 1); + if (a->utf8) + utf8_emit (a->terminal, ca.chr); + else + ansi_emit_noutf8 (a->terminal, ca.chr); a->pos.x++; @@ -883,7 +895,7 @@ ansi_free (ANSI * a) } ANSI * -ansi_new_from_terminal (TTY * t) +ansi_new_from_terminal (TTY * t, int utf8) { ANSI *ret; @@ -892,6 +904,7 @@ ansi_new_from_terminal (TTY * t) ret->terminal = t; + ret->utf8 = utf8; ret->update = ansi_update; ret->reset = ansi_reset; ret->terminal_reset = ansi_terminal_reset; |