/*
* $Log$
+ * Revision 1.47 2008/02/27 09:42:22 james
+ * *** empty log message ***
+ *
+ * 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 ***
*
void
vt102_log_line (Context * c, int line)
{
- CRT_Pos e = { c->v->current_width - 1, line };
+ CRT_Pos e = { c->v->current_size.x - 1, line };
CRT_Pos p = { 0, line };
char logbuf[4 * (VT102_MAX_COLS + 1)], *logptr = logbuf;
case VT102_PRIVATE_MODE_132COLS:
/* We don't implement 132 col mode - yet */
- v->current_width =
+ v->current_size.x =
v->
private_modes[VT102_PRIVATE_MODE_132COLS] ? VT102_COLS_132 :
VT102_COLS_80;
- v->crt.width = v->current_width;
- v->screen_end.x = v->current_width - 1;
+ v->crt.size = v->current_size;
+ v->crt.size.y++;
+ v->screen_end=v->current_size;
+ v->screen_end.x--;
+ v->screen_end.y--;
v->top_margin = v->screen_start;
v->bottom_margin = v->screen_end;
vt102_cursor_home (v);
case 'K':
{
CRT_Pos ls = { 0, v->pos.y };
- CRT_Pos le = { v->current_width - 1, v->pos.y };
+ CRT_Pos le = { v->current_size.x - 1, v->pos.y };
if (len == 2)
narg = 0; /*Different default */
break;
case 'K':
{
- CRT_Pos le = { v->current_width - 1, v->pos.y };
+ CRT_Pos le = { v->current_size.x - 1, v->pos.y };
crt_erase (&v->crt, v->pos, le, 1, v->color);
}
break;
void
vt102_status_line (VT102 * v, char *str)
{
- int i = v->current_width - 1;
- CRT_CA *ca = &v->crt.screen[CRT_ADDR (VT102_STATUS_ROW, 0)];
+ int i;
+ CRT_CA *ca = &v->crt.screen[CRT_ADDR (v->current_size.y, 0)];
- for (i = 0; i < v->current_width; ++i)
+ for (i = 0; i < v->current_size.x; ++i)
{
ca->attr = CRT_ATTR_REVERSE;
ca->color = CRT_COLOR_NORMAL;
v->application_keypad_mode = 0;
- v->current_width = VT102_COLS_80;
- v->crt.width = v->current_width;
- v->screen_end.x = v->current_width - 1;
+ v->current_size=v->original_size;
+ v->crt.size = v->current_size;
+ v->crt.size.y++;
+ v->screen_end = v->current_size;
+ v->screen_end.x--;
+ v->screen_end.y--;
v->top_margin = v->screen_start;
v->bottom_margin = v->screen_end;
v->screen_start.x = 0;
v->screen_start.y = 0;
- v->current_width = VT102_COLS_80;
- v->crt.width = v->current_width;
- v->screen_end.x = v->current_width - 1;
- v->screen_end.y = VT102_ROWS - 1;
+ v->current_size=v->original_size;
+ v->crt.size=v->current_size;
+ v->crt.size.y++;
+ v->screen_end=v->current_size;
+ v->screen_end.x--;
+ v->screen_end.y--;
vt102_cursor_home (v);
vt102_status_line (v, "");
}
VT102 *
-vt102_new (int width)
+vt102_new (CRT_Pos *size)
{
VT102 *v;
v->xn_glitch = 1;
- vt102_reset (v);
+
+ if (size) {
+ v->original_size = *size;
- 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);
- }
+ if (v->original_size.x<1) v->original_size.x=1;
+ if (v->original_size.y<1) v->original_size.y=1;
+
+ if (v->original_size.x>VT102_MAX_COLS) v->original_size.x=VT102_MAX_COLS;
+ if (v->original_size.y>VT102_ROWS) v->original_size.y=VT102_ROWS;
+
+ } else {
+ v->original_size.x=VT102_COLS_80;
+ v->original_size.y=VT102_ROWS;
+ }
+
+ vt102_reset (v);
return v;
}