chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / vt102.c
index a8d4388610ccccaa82b16c0c6631784fa8723718..586b7d91ccbefbead876589bb4926d56226a8c8c 100644 (file)
@@ -10,6 +10,21 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.29  2008/02/15 03:32:07  james
+ * *** empty log message ***
+ *
+ * Revision 1.28  2008/02/14 10:34:30  james
+ * *** empty log message ***
+ *
+ * Revision 1.27  2008/02/14 02:46:45  james
+ * *** empty log message ***
+ *
+ * Revision 1.26  2008/02/14 01:55:57  james
+ * *** empty log message ***
+ *
+ * Revision 1.25  2008/02/13 16:57:29  james
+ * *** empty log message ***
+ *
  * Revision 1.24  2008/02/13 09:12:21  james
  * *** empty log message ***
  *
@@ -264,6 +279,18 @@ vt102_log_line (Context * c, int line)
   c->l->log (c->l, logbuf);
 }
 
+/*Called for every upward scroll with same args*/
+void
+vt102_history (Context * c, CRT_Pos t, CRT_Pos b)
+{
+/*Only log if it scrolls off the top*/
+  if (t.y)
+    return;
+
+  t.x = 0;
+  history_add (c->h, &(c->v->crt.screen[CRT_ADDR_POS (&t)]));
+}
+
 void
 vt102_clip_cursor (VT102 * v, CRT_Pos tl, CRT_Pos br)
 {
@@ -314,7 +341,9 @@ vt102_cursor_advance_line (Context * c)
       (couldscroll))
     {
       vt102_log_line (c, v->pos.y);
-      //FIXME call out to history
+
+      vt102_history (c, v->top_margin, v->bottom_margin);
+
       crt_scroll_up (&v->crt, v->top_margin, v->bottom_margin, 1);
       return;
     }
@@ -776,6 +805,7 @@ vt102_parse_esc (Context * c, int ch)
       if (v->pos.y == v->bottom_margin.y)
         {
           vt102_log_line (c, v->pos.y);
+          vt102_history (c, v->top_margin, v->bottom_margin);
           crt_scroll_up (&v->crt, v->top_margin, v->bottom_margin, 1);
         }
       else
@@ -938,8 +968,8 @@ vt102_parse_csi (Context * c, char *buf, int len)
             {
               while (narg--)
                 {
-                  //FIXME call out to history
-                  crt_scroll_up (&v->crt, v->pos, v->bottom_margin, 0);
+                  vt102_history (c, v->pos, v->bottom_margin);
+                  crt_scroll_up (&v->crt, v->pos, v->bottom_margin, 1);
                 }
             }
           break;
@@ -1163,7 +1193,8 @@ vt102_parse_char (Context * c, int ch)
       v->current_line = v->pos;
     }
 
-  vt102_status_line (v, "VT102 foo bar baz I'm the urban spaceman baby");
+  if (c->d)
+    cmd_show_status (c->d, c);
 }
 
 vt102_parse (Context * c, char *buf, int len)
@@ -1187,6 +1218,10 @@ void
 vt102_send (Context * c, uint8_t key)
 {
   uint8_t ch;
+
+  if (!c->t)
+    return;
+
 #if 0
   fprintf (stderr, "vts: %d(%c)\n", key, (key > 31) ? key : ' ');
 #endif
@@ -1385,7 +1420,7 @@ vt102_reset (VT102 * v)
 
   vt102_save_state (v);
 
-  vt102_status_line (v, "VT102 foo bar baz I'm the urban spaceman baby");
+  vt102_status_line (v, "");
 
 }