[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

bogl-term reverse video patch, please review



Greetings,

Attached with the message is a patch that enables the bterm terminal,
used for i18n installation, to handle reverse video attributes.  It is
specifically aimed at cfdisk, but also tested to work with other
programs, such as joe.  In addition to the patch, you will also need to
recompile the terminfo description of bterm in
scripts/rootdisk/prototype/usr/lib/terminfo/b for things to work properly.
(Anyone know why there is an empty terminfo tree in /etc/terminfo?)
Please review, and if there are no problems, I will check it into the
CVS in a few days.

Since I am not on the list, I would appreciate it if you could CC me
your replies.  Thank you for your time.

-- Chuan-kai Lin
diff -ur bogl.orig/bogl-term.c bogl/bogl-term.c
--- bogl.orig/bogl-term.c	Thu Jan 18 03:35:36 2001
+++ bogl/bogl-term.c	Thu Jan 18 03:36:52 2001
@@ -49,6 +49,7 @@
   term->xpos = 0, term->ypos = 0;
   term->fg = term->def_fg = 0;
   term->bg = term->def_bg = 7;
+  term->rev = 0;
   term->state = 0;
   term->cur_visible = 1;
   mbrtowc(0, 0, 0, &term->ps);
@@ -123,7 +124,10 @@
 
     if (bogl_in_font (term->font, wc))
     {
-        bogl_text (XPOS(x), YPOS(y), buf, k, fg, bg, ul, term->font);
+        if (term->rev)
+            bogl_text (XPOS(x), YPOS(y), buf, k, bg, fg, ul, term->font);
+        else
+            bogl_text (XPOS(x), YPOS(y), buf, k, fg, bg, ul, term->font);
 
         if (cchars)
             for (j = 0; j < MAX_CCHARS && cchars[j]; j++)
@@ -382,6 +386,10 @@
             {                   /* setab=\E[4%p1%dm, setaf=\E[3%p1%dm */
                 if (term->arg[0] == 4 || term->arg[0] == 24)
                     term->ul = term->arg[0] == 4;
+                else if (term->state==1 && term->arg[0]==7)
+                    term->rev = 1;
+                else if (term->state==1 && term->arg[0]==8)
+                    term->rev = 0;
                 else if (30 <= term->arg[0] && term->arg[0] < 38)
                     term->fg = term->arg[0] - 30;
                 else if (40 <= term->arg[0] && term->arg[0] < 48)
@@ -441,8 +449,16 @@
                 clear_left (term);
                 i = SCR (term->xpos, term->ypos);
                 term->screen[i] = wc;
-                term->screenfg[i] = term->fg;
-                term->screenbg[i] = term->bg;
+                if (term->rev)
+                {
+                    term->screenfg[i] = term->bg;
+                    term->screenbg[i] = term->fg;
+                }
+                else
+                {
+                    term->screenfg[i] = term->fg;
+                    term->screenbg[i] = term->bg;
+                }
                 term->screenul[i] = term->ul;
                 free (term->cchars[i]);
                 term->cchars[i] = NULL;
@@ -457,7 +473,10 @@
 
                 if (bogl_in_font (term->font, wc))
                 {
-                    bogl_text (XPOS (term->xpos), YPOS (term->ypos), buf, kk, term->fg, term->bg, term->ul, term->font);
+                    if (term->rev)
+                        bogl_text (XPOS (term->xpos), YPOS (term->ypos), buf, kk, term->bg, term->fg, term->ul, term->font);
+                    else
+                        bogl_text (XPOS (term->xpos), YPOS (term->ypos), buf, kk, term->fg, term->bg, term->ul, term->font);
                     term->xp = term->xpos, term->yp = term->ypos;
                     term->xpos += w;
                 }
diff -ur bogl.orig/bogl-term.h bogl/bogl-term.h
--- bogl.orig/bogl-term.h	Thu Jan 18 03:35:36 2001
+++ bogl/bogl-term.h	Thu Jan 18 03:33:40 2001
@@ -11,7 +11,7 @@
   int xstep, ystep;
   int xpos, ypos;
   int def_fg, def_bg;
-  int fg, bg, ul;
+  int fg, bg, ul, rev;
   int state;
   int cur_visible;
   int xp, yp;
diff -ur bogl.orig/bterm.ti bogl/bterm.ti
--- bogl.orig/bterm.ti	Thu Jan 18 03:35:36 2001
+++ bogl/bterm.ti	Thu Jan 18 03:33:52 2001
@@ -10,3 +10,4 @@
   setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
   civis=\E[?25l, cnorm=\E[?25h,
   smul=\E[4m, rmul=\E[24m,
+  rev=\E[7m, sgr0=\E[8m,

Reply to: