/*
* $Log$
+ * Revision 1.14 2008/02/07 12:21:16 james
+ * *** empty log message ***
+ *
+ * Revision 1.13 2008/02/07 12:16:04 james
+ * *** empty log message ***
+ *
* Revision 1.12 2008/02/07 11:32:41 james
* *** empty log message ***
*
{
ansi_write (a, "\033[0m", 4);
a->attr = CRT_ATTR_NORMAL;
+ a->color = ANSI_INVAL;
+}
+
+void
+ansi_set_color (ANSI * a, int color)
+{
+ int dif;
+ char buf[16];
+ int i;
+ int fg,bg;
+
+ if ((a->color == ANSI_INVAL) || (color!=a->color)) {
+ fg=CRT_COLOR_FG(color);
+ bg=CRT_COLOR_BG(color);
+
+ if (fg & CRT_COLOR_INTENSITY) {
+ fg+=90;
+ } else {
+ fg+=30;
+ }
+
+ if (bg & CRT_COLOR_INTENSITY) {
+ bg+=100;
+ } else {
+ bg+=40;
+ }
+
+ i=sprintf(buf,"\033[%d;%dm",fg,bg);
+#if 0
+ fprintf(stderr,"Color set to %d %d %x\n",fg,bg,color);
+#endif
+
+ ansi_write (a,buf,i);
+ a->color=color;
+ }
}
void
a->attr = attr;
+#if 0
if (attr == CRT_ATTR_NORMAL)
{
ansi_force_attr_normal (a);
return;
}
+#endif
if (dif & CRT_ATTR_UNDERLINE)
{
ca.chr = ' ';
ansi_set_attr (a, ca.attr);
+ ansi_set_color(a,ca.color);
ansi_write (a, &ca.chr, 1);
crt_cls (&a->crt);
ansi_force_attr_normal (a);
+ ansi_set_color(a,CRT_COLOR_NORMAL);
ansi_move (a, p);
ansi_write (a, "\033[2J", 4);
/*different emulators leave cursor in different places after cls differently*/
ansi_showhide_cursor (a, 1);
ansi_set_attr (a, CRT_ATTR_REVERSE);
+ ansi_set_color(a,CRT_MAKE_COLOR(CRT_COLOR_WHITE,CRT_COLOR_RED));
ansi_move (a, p);
ansi_write (a, msg, sizeof (msg));
return -1;
#endif
-#if 1
+#if 0
if (*buf == 1)
return 1;
#endif