/*
* $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 ***
+ *
* Revision 1.28 2008/02/22 17:07:00 james
* *** empty log message ***
*
}
+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++;
/*Roll HISTORY_GUESS_SCROLL lines up putting the top line into the xterm's history */
- /*Make extra lines a predictable colour*/
+ /*Make extra lines a predictable colour */
ansi_set_color (a, CRT_COLOR_NORMAL);
ansi_showhide_cursor (a, 1);
/* erase new line */
s.y = e.y;
e.x = CRT_COLS - 1;
- crt_erase (&a->crt, s, e, 1,CRT_COLOR_NORMAL);
+ crt_erase (&a->crt, s, e, 1, CRT_COLOR_NORMAL);
}
}
}
ANSI *
-ansi_new_from_terminal (TTY * t)
+ansi_new_from_terminal (TTY * t, int utf8)
{
ANSI *ret;
ret->terminal = t;
+ ret->utf8 = utf8;
ret->update = ansi_update;
ret->reset = ansi_reset;
ret->terminal_reset = ansi_terminal_reset;