chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / vt102.c
index 7c211c51cc3d70902e559e08d21033ca53910da0..a879999359a729720987ca7921296d094df93929 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.45  2008/02/27 01:31:14  james
+ * *** empty log message ***
+ *
  * Revision 1.44  2008/02/27 00:54:16  james
  * *** empty log message ***
  *
@@ -387,7 +390,7 @@ vt102_log_line (Context * c, int line)
 {
   CRT_Pos e = { c->v->current_width - 1, line };
   CRT_Pos p = { 0, line };
-  char logbuf[4*(VT102_MAX_COLS + 1)],*logptr=logbuf;
+  char logbuf[4 * (VT102_MAX_COLS + 1)], *logptr = logbuf;
 
   if (!c->l)
     return;
@@ -404,9 +407,9 @@ vt102_log_line (Context * c, int line)
       int ch = c->v->crt.screen[CRT_ADDR_POS (&p)].chr;
       if (ch < 32)
         ch = ' ';
-       logptr+=utf8_encode(logptr,ch);
+      logptr += utf8_encode (logptr, ch);
     }
-  *logptr=0;
+  *logptr = 0;
 
   c->l->log (c->l, logbuf);
 }
@@ -996,12 +999,15 @@ vt102_regular_char (Context * c, VT102 * v, uint32_t ch)
 
   if (ch < VT102_CHARSET_SIZE)
     {
-       int cs;
-       if ((cs=vt102_charset_c0[ch])) {
-               ch=cs;
-       } else if ((cs=charset_from_csid[v->g[v->cs]][ch])) {
-               ch=cs;
-       }
+      int cs;
+      if ((cs = vt102_charset_c0[ch]))
+        {
+          ch = cs;
+        }
+      else if ((cs = charset_from_csid[v->g[v->cs]][ch]))
+        {
+          ch = cs;
+        }
     }
   v->crt.screen[CRT_ADDR_POS (&v->pos)].chr = ch;
   v->crt.screen[CRT_ADDR_POS (&v->pos)].attr = v->attr;
@@ -1738,10 +1744,10 @@ vt102_parse_char (Context * c, int ch)
           break;
 #if 0
          /*ACK*/ case 6:
-       break;
+          break;
 #endif
          /*BEL*/ case 7:
-               //FIXME beep
+          //FIXME beep
           break;
          /*BS*/ case 8:
           vt102_cursor_retreat (c->v);
@@ -2016,7 +2022,7 @@ vt102_reset (VT102 * v)
 }
 
 VT102 *
-vt102_new (void)
+vt102_new (int width)
 {
   VT102 *v;
 
@@ -2026,6 +2032,14 @@ vt102_new (void)
 
   vt102_reset (v);
 
+  if (width) {
+          v->current_width =width;
+          v->crt.width = v->current_width;
+          v->screen_end.x = v->current_width - 1;
+          v->top_margin = v->screen_start;
+          v->bottom_margin = v->screen_end;
+          vt102_cursor_home (v);
+  }
 
   return v;
 }