aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vt102.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/vt102.c b/src/vt102.c
index 8b61929..1649c4f 100644
--- a/src/vt102.c
+++ b/src/vt102.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.8 2008/02/06 11:49:47 james
+ * *** empty log message ***
+ *
* Revision 1.7 2008/02/06 11:30:37 james
* *** empty log message ***
*
@@ -244,6 +247,25 @@ vt102_delete_from_line (VT102 * v, CRT_Pos p)
}
void
+vt102_insert_into_line (VT102 * v, CRT_Pos p)
+{
+ int n = v->bottom_margin.x - p.x;
+
+ if (n < 0)
+ return;
+
+ if (n)
+ {
+
+ memmove (&v->crt.screen[CRT_ADDR_POS (&p) + 1],
+ &v->crt.screen[CRT_ADDR_POS (&p) ], sizeof (CRT_CA) * n);
+ }
+
+ v->crt.screen[CRT_ADDR (p.y, v->bottom_margin.x)].chr = ' ';
+ v->crt.screen[CRT_ADDR (p.y, v->bottom_margin.x)].attr = CRT_ATTR_NORMAL;
+}
+
+void
vt102_change_mode (VT102 * v, int private, char *ns, int set)
{
int m;
@@ -566,6 +588,8 @@ vt102_parse_char (VT102 * v, int c)
/*VT*/ case 11:
/*FF*/ case 12:
vt102_cursor_motion (v, 0, 1, 1);
+ if (v->modes[VT102_MODE_NEWLINE_MODE])
+ v->pos.x = v->top_margin.x;
break;
/*CR*/ case 13:
v->pos.x = v->top_margin.x;
@@ -594,6 +618,10 @@ vt102_parse_char (VT102 * v, int c)
/*DEL*/ case 127:
break;
/*regular character */ default:
+
+ if (v->modes[VT102_MODE_INSERT])
+ vt102_insert_into_line(v,v->pos);
+
v->crt.screen[CRT_ADDR_POS (&v->pos)].chr = c;
v->crt.screen[CRT_ADDR_POS (&v->pos)].attr = v->attr;
vt102_cursor_motion (v, 1, 0, 1);
@@ -632,4 +660,11 @@ vt102_reset (VT102 * v)
v->pos = v->screen_start;
+ memset(v->modes,0,VT102_NMODES);
+ memset(v->private_modes,0,VT102_NMODES);
+
+ v->modes[VT102_PRIVATE_MODE_AUTO_WRAP]=1;
+ v->modes[VT102_PRIVATE_MODE_AUTO_REPEAT]=1;
+
+
}