chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / ansi.c
index bdc3a56ce899911288267b2352c042f39e75b9d2..3e925c566a3ee4dc5138264d1181fdef06e9a5ac 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.6  2008/02/06 17:53:28  james
+ * *** empty log message ***
+ *
  * Revision 1.5  2008/02/06 15:53:22  james
  * *** empty log message ***
  *
@@ -216,6 +219,7 @@ ansi_set_attr (ANSI * a, int attr)
         }
       else
         {
+          ansi_write (a, "\033[21m", 5);
           ansi_write (a, "\033[22m", 5);
         }
     }
@@ -267,8 +271,10 @@ ansi_draw (ANSI * a, CRT * c)
 {
   CRT_Pos p;
   int o;
+  int hidden_cursor=0;
+
+  
 
-  ansi_showhide_cursor (a, 1);
 
   for (p.y = 0; p.y < CRT_ROWS; ++p.y)
     {
@@ -281,6 +287,7 @@ ansi_draw (ANSI * a, CRT * c)
             continue;
           if (crt_ca_cmp (a->crt.screen[o], c->screen[o]))
             {
+             ansi_showhide_cursor (a, 1);
               a->crt.screen[o] = c->screen[o];
 
               ansi_move (a, p);
@@ -289,6 +296,27 @@ ansi_draw (ANSI * a, CRT * c)
         }
     }
 
+
+  if ((CRT_COLS>a->size.x) || (CRT_ROWS>a->size.y)) {
+       char msg[]="Window is too small";
+       p.x=0;
+       p.y=0;
+
+       ansi_showhide_cursor (a, 1);
+       ansi_set_attr (a, CRT_ATTR_REVERSE);
+       ansi_move(a,p);
+       
+       ansi_write (a, msg, sizeof(msg));
+       a->pos.x = ANSI_INVAL;
+   }
+       
+
+  if ((c->pos.x>=a->size.x)
+  || (c->pos.y>=a->size.y)) {
+       ansi_showhide_cursor (a, 1);
+       return;
+  }
+
   a->crt.pos = c->pos;
   ansi_move (a, a->crt.pos);