/*
* $Log$
+ * Revision 1.46 2008/02/27 01:31:38 james
+ * *** empty log message ***
+ *
+ * Revision 1.45 2008/02/27 01:31:14 james
+ * *** empty log message ***
+ *
+ * Revision 1.44 2008/02/27 00:54:16 james
+ * *** empty log message ***
+ *
* Revision 1.43 2008/02/27 00:27:22 james
* *** empty log message ***
*
{
CRT_Pos e = { c->v->current_width - 1, line };
CRT_Pos p = { 0, line };
- char logbuf[VT102_MAX_COLS + 1];
+ char logbuf[4 * (VT102_MAX_COLS + 1)], *logptr = logbuf;
if (!c->l)
return;
int ch = c->v->crt.screen[CRT_ADDR_POS (&p)].chr;
if (ch < 32)
ch = ' ';
- if (ch > 126)
- ch = ' ';
- logbuf[p.x] = ch;
+ logptr += utf8_encode (logptr, ch);
}
- logbuf[p.x] = 0;
+ *logptr = 0;
c->l->log (c->l, logbuf);
}
vt102_regular_char (Context * c, VT102 * v, uint32_t ch)
{
+
vt102_do_pending_wrap (c);
+
if (v->modes[VT102_MODE_INSERT])
vt102_insert_into_line (v, v->pos);
+ v->last_reg_char = ch;
+
+
if (ch < VT102_CHARSET_SIZE)
{
- int cs = charset_from_csid[v->g[v->cs]][ch];
- v->crt.screen[CRT_ADDR_POS (&v->pos)].chr = cs ? cs : ch;
- }
- else
- {
- v->crt.screen[CRT_ADDR_POS (&v->pos)].chr = ch;
+ int cs;
+ if ((cs = vt102_charset_c0[ch]))
+ {
+ ch = cs;
+ }
+ else if ((cs = charset_from_csid[v->g[v->cs]][ch]))
+ {
+ ch = cs;
+ }
}
+ v->crt.screen[CRT_ADDR_POS (&v->pos)].chr = ch;
v->crt.screen[CRT_ADDR_POS (&v->pos)].attr = v->attr;
v->crt.screen[CRT_ADDR_POS (&v->pos)].color = v->color;
vt102_cursor_advance (c);
- v->last_reg_char = ch;
}
vt102_send_id (Context * c, char *buf)
switch (ch)
{
+#if 0
/*NUL*/ case 0:
/*SOH*/ case 1:
/*STX*/ case 2:
/*ETX*/ case 3:
/*EOT*/ case 4:
break;
+#endif
/*ENQ*/ case 5:
vt102_send_id (c, terminal_id);
break;
+#if 0
/*ACK*/ case 6:
+ break;
+#endif
/*BEL*/ case 7:
+ //FIXME beep
break;
/*BS*/ case 8:
vt102_cursor_retreat (c->v);
/*select G0 */
v->cs = 0;
break;
+#if 0
/*DLE*/ case 16:
/*DC1 */ case 17:
/*DC2 */ case 18:
/*EM*/ case 25:
/*SUB*/ case 26:
break;
+#endif
/*ESC*/ case 27:
p->in_escape++;
return;
+#if 0
/*FS*/ case 28:
/*GS*/ case 29:
/*RS*/ case 30:
/*US*/ case 31:
/*DEL*/ case 127:
break;
+#endif
/*regular character */ default:
vt102_regular_char (c, v, ch);
}
}
VT102 *
-vt102_new (void)
+vt102_new (int width)
{
VT102 *v;
vt102_reset (v);
+ if (width)
+ {
+ v->current_width = width;
+ v->crt.width = v->current_width;
+ v->screen_end.x = v->current_width - 1;
+ v->top_margin = v->screen_start;
+ v->bottom_margin = v->screen_end;
+ vt102_cursor_home (v);
+ }
return v;
}