chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / history.c
index b8637aae63380be2143753a1b52eb5295a512ef3..24d3692de1815a309ec40cbbd51a61bbd7badd82 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.3  2008/02/13 16:57:29  james
+ * *** empty log message ***
+ *
  * Revision 1.2  2008/02/12 22:36:46  james
  * *** empty log message ***
  *
@@ -49,13 +52,28 @@ history_free (History * h)
 void
 history_add (History * h, CRT_CA * c)
 {
+  History_ent *e;
   if (!h)
     return;
 
-  memcpy (h->lines[h->wptr].line, c, sizeof (CRT_CA) * CRT_COLS);
-  h->wptr++;
+  e = &h->lines[h->wptr];
+  HISTORY_INC (h, h->wptr);
+
+  memcpy (e->line, c, sizeof (CRT_CA) * CRT_COLS);
+  time (&e->t);
+  e->valid = 1;
+
+#if 0
+  {
+    int i = CRT_COLS;
+    while (i--)
+      {
+        fputc (c->chr, stderr);
+        c++;
+      }
+    fputc ('\n', stderr);
+  }
+#endif
 
-  if (h->wptr == h->nlines)
-    h->wptr = 0;
 
 }