chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / ansi.c
index 42f6a4c650476b752907670e96b36dbfcbc55c1d..970d353a2670d874d0f59ce80f04d897bd52da5a 100644 (file)
@@ -10,6 +10,15 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.36  2008/02/28 22:00:42  james
+ * *** empty log message ***
+ *
+ * Revision 1.35  2008/02/28 16:57:51  james
+ * *** empty log message ***
+ *
+ * Revision 1.34  2008/02/27 09:42:53  james
+ * *** empty log message ***
+ *
  * Revision 1.33  2008/02/27 09:42:21  james
  * *** empty log message ***
  *
@@ -525,10 +534,10 @@ ansi_draw_line (ANSI * a, CRT_CA * cap, int y)
 }
 
 static void
-ansi_resize_check (ANSI * a, CRT_Pos *size)
+ansi_resize_check (ANSI * a, CRT_Pos * size)
 {
 
-  if ((size && crt_pos_cmp(a->crt.size,*size))
+  if ((size && crt_pos_cmp (a->crt.size, *size))
       || crt_pos_cmp (a->terminal->size, a->size))
     {
 
@@ -542,7 +551,7 @@ ansi_resize_check (ANSI * a, CRT_Pos *size)
       crt_reset (&a->crt);
 
       if (size)
-        a->crt.size =*size;
+        a->crt.size = *size;
 
 // FIXME: -- echos back crap?
 //  a->terminal->xmit (a->terminal, "\033[c", 3);
@@ -574,7 +583,7 @@ ansi_history (ANSI * a, History * h)
 {
   char buf[32];
   int i;
-      int guess_scroll;
+  int guess_scroll;
 /*Do we need to catch up on history?*/
 
   if (a->history_ptr == h->wptr)
@@ -584,7 +593,7 @@ ansi_history (ANSI * a, History * h)
   if ((a->size.x < a->crt.size.x) || (a->size.y < a->crt.size.y))
     return;
 
-  guess_scroll=a->crt.size.y-1; /*Bototm line should be a status line*/
+  guess_scroll = a->crt.size.y - 1; /*Bototm line should be a status line */
 
 
   ansi_force_attr_normal (a);
@@ -716,12 +725,32 @@ ansi_reset (ANSI * a, CRT * c)
 static void
 ansi_terminal_reset (ANSI * a)
 {
-  CRT_Pos p = { 0, a->crt.size.y};
+  CRT_Pos p = { 0, a->crt.size.y };
   ansi_force_attr_normal (a);
 
   ansi_move (a, p);
 }
 
+
+int ansi_key(ANSI *a,Context *c,int key)
+{
+
+  if (!c->d)
+    return c->k->key (c->k, c, key);
+
+  cmd_show_status (c->d, c);
+
+  if (c->d->active)
+    return cmd_key (c->d, c,a, key);
+
+  if (key == CMD_KEY)
+    return cmd_activate (c->d, c);
+
+
+  return c->k->key (c->k, c, key);
+}
+
+
 static void
 ansi_flush_escape (ANSI * a, Context * c)
 {
@@ -730,7 +759,7 @@ ansi_flush_escape (ANSI * a, Context * c)
 
   for (i = 0; i < p->escape_ptr; ++i)
     {
-      keydis_key (c->k, c, p->escape_buf[i]);
+      ansi_key (a, c, p->escape_buf[i]);
     }
 
   p->escape_ptr = 0;
@@ -749,11 +778,11 @@ ansi_parse_deckey (ANSI * a, Context * c)
 
   if ((p->escape_buf[2] >= 'A') || (p->escape_buf[2] <= 'Z'))
     {
-      keydis_key (c->k, c, KEY_UP + (p->escape_buf[2] - 'A'));
+      ansi_key (a, c, KEY_UP + (p->escape_buf[2] - 'A'));
     }
   else if ((p->escape_buf[2] >= 'a') || (p->escape_buf[2] <= 'z'))
     {
-      keydis_key (c->k, c, KEY_154 + (p->escape_buf[2] - 'a'));
+      ansi_key (a, c, KEY_154 + (p->escape_buf[2] - 'a'));
     }
   else
     {
@@ -776,7 +805,7 @@ ansi_parse_ansikey (ANSI * a, Context * c)
     }
   if ((p->escape_buf[2] >= '0') || (p->escape_buf[2] <= '9'))
     {
-      keydis_key (c->k, c, KEY_180 + (p->escape_buf[2] - '0'));
+      ansi_key (a, c, KEY_180 + (p->escape_buf[2] - '0'));
     }
   else
     {
@@ -889,7 +918,7 @@ ansi_parse_char (ANSI * a, Context * c, int ch)
     }
   else
     {
-      keydis_key (c->k, c, ch);
+      ansi_key (a, c, ch);
     }
 
 }
@@ -945,6 +974,7 @@ ansi_update (ANSI * a, Context * c)
 {
   ansi_history (a, c->h);
   ansi_draw (a, &c->v->crt);
+  tty_length(a->terminal,c->v->crt.size.y);
 }
 
 static void