chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / vt102.c
index 1d3709bcbb87a0fe02714fbfe502094fcb45a9cf..74888035be62746b0bd559c00299c755b96f37b1 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.52  2008/02/28 16:57:52  james
+ * *** empty log message ***
+ *
  * Revision 1.51  2008/02/28 16:37:16  james
  * *** empty log message ***
  *
@@ -402,9 +405,11 @@ in_margins (VT102 * v, CRT_Pos p)
 
   return 1;
 }
-void   vt102_crt_update(Context *c)
+
+void
+vt102_crt_update (Context * c)
 {
-VT102 *v=c->v;
+  VT102 *v = c->v;
 
   v->crt.pos = v->pos;
   v->crt.hide_cursor =
@@ -419,26 +424,28 @@ VT102 *v=c->v;
   if (c->d)
     cmd_show_status (c->d, c);
 }
-void vt102_do_resize(Context *c)
+
+void
+vt102_do_resize (Context * c)
 {
 
-VT102 *v=c->v;
+  VT102 *v = c->v;
 
-          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);
-          crt_cls (&v->crt);
+  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);
+  crt_cls (&v->crt);
 
-         if (c->t)
-               tty_winch(c->t,v->current_size);
+  if (c->t)
+    tty_winch (c->t, v->current_size);
 
-       log_f(c->l,"<size now %dx%d>", v->current_size.x,v->current_size.y);
-vt102_crt_update(c);
+  log_f (c->l, "<size now %dx%d>", v->current_size.x, v->current_size.y);
+  vt102_crt_update (c);
 }
 
 
@@ -750,9 +757,9 @@ vt102_insert_into_line (VT102 * v, CRT_Pos p)
 
 
 void
-vt102_change_mode (Context *c, int private, char *ns, int set)
+vt102_change_mode (Context * c, int private, char *ns, int set)
 {
-  VT102 *v=c->v;
+  VT102 *v = c->v;
   int m;
 
 
@@ -794,7 +801,7 @@ vt102_change_mode (Context *c, int private, char *ns, int set)
             private_modes[VT102_PRIVATE_MODE_132COLS] ? VT102_COLS_132 :
             VT102_COLS_80;
 
-         vt102_do_resize(c);
+          vt102_do_resize (c);
           break;
         }
 
@@ -808,9 +815,9 @@ vt102_change_mode (Context *c, int private, char *ns, int set)
 }
 
 void
-vt102_parse_mode_string (Context *c, char *buf, int len)
+vt102_parse_mode_string (Context * c, char *buf, int len)
 {
-  VT102 *v=c->v;
+  VT102 *v = c->v;
   int private = 0;
   char last = buf[len - 1];
   char num[4];
@@ -1627,9 +1634,9 @@ vt102_parser_reset (VT102_parser * p)
 
 
 void
-vt102_reset_state (Context *c)
+vt102_reset_state (Context * c)
 {
-  VT102 *v=c->v;
+  VT102 *v = c->v;
   vt102_parser_reset (&v->parser);
 
   v->attr = CRT_ATTR_NORMAL;
@@ -1639,7 +1646,7 @@ vt102_reset_state (Context *c)
 
   v->current_size = v->original_size;
 
-  vt102_do_resize(c);
+  vt102_do_resize (c);
 
   memset (v->modes, 0, VT102_NMODES);
   memset (v->private_modes, 0, VT102_NMODES);
@@ -1856,7 +1863,7 @@ vt102_parse_char (Context * c, int ch)
 #endif
     }
 
-  vt102_crt_update(c);
+  vt102_crt_update (c);
 
 
 }
@@ -2032,7 +2039,7 @@ vt102_send (Context * c, uint8_t key)
 void
 vt102_reset (Context * c)
 {
-  VT102 *v=c->v;
+  VT102 *v = c->v;
   VT102_parser *p = &v->parser;
 
 
@@ -2084,14 +2091,14 @@ vt102_new (CRT_Pos * size)
 
       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;
+      if (v->original_size.y > VT102_MAX_ROWS)
+        v->original_size.y = VT102_MAX_ROWS;
 
     }
   else
     {
       v->original_size.x = VT102_COLS_80;
-      v->original_size.y = VT102_ROWS;
+      v->original_size.y = VT102_ROWS_24;
     }
 
   return v;
@@ -2103,25 +2110,28 @@ vt102_set_ansi (VT102 * v, int ansi)
   v->xn_glitch = ansi ? 0 : 1;
 }
 
-void vt102_resize(Context *c,CRT_Pos size)
+void
+vt102_resize (Context * c, CRT_Pos size)
 {
-       log_f(c->l,"<size change to %dx%d requested>", size.x,size.y);
+  log_f (c->l, "<size change to %dx%d requested>", size.x, size.y);
 
-       if (!size.x) size.x=c->v->current_size.x;
-       if (!size.y) size.y=c->v->current_size.y;
+  if (!size.x)
+    size.x = c->v->current_size.x;
+  if (!size.y)
+    size.y = c->v->current_size.y;
 
-      if (size.x < 1)
-        size.x = 1;
-      if (size.y < 1)
-        size.y = 1;
+  if (size.x < 1)
+    size.x = 1;
+  if (size.y < 1)
+    size.y = 1;
 
-      if (size.x > VT102_MAX_COLS)
-        size.x = VT102_MAX_COLS;
-      if (size.y > VT102_ROWS)
-        size.y = VT102_ROWS;
+  if (size.x > VT102_MAX_COLS)
+    size.x = VT102_MAX_COLS;
+  if (size.y > VT102_MAX_ROWS)
+    size.y = VT102_MAX_ROWS;
 
-       c->v->current_size=size;
-       vt102_do_resize(c);
+  c->v->current_size = size;
+  vt102_do_resize (c);
 }
 
 void