repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: ccf4df4bb0f015292799cc57dbaf45ebb172070c:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit ccf4df4bb0f015292799cc57dbaf45ebb172070c
Author: Emanuele Giaquinta 
Date:   Sat Apr 17 23:00:45 2010 +0000

    Disable colorRV resource.
    Make OSC 17 apply to highlightColor.
    Make highlightColor apply also to selected cells with reverse video.
    Add highlightTextColor resource to change the foreground colour of
    highlighted characters.

diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod
index 819f1ec907e1c4e4ba4e57ac00fb330228c49652..
index ..b6efa55a54deef74b3ab3756a640cd3074d1889e 100644
--- a/doc/rxvt.1.pod
+++ b/doc/rxvt.1.pod
@@ -648,16 +648,21 @@ foreground colour is the default. If font styles are not available
 Use the specified colour to display underlined characters when the
 foreground colour is the default.

-=item B I
-
-Use the specified colour as the background for reverse video characters
-when OPTION_HC is disabled (--disable-frills).
-
 =item B I

 If set, use the specified colour as the colour for the underline
 itself. If unset, use the foreground colour.

+=item B I
+
+If set, use the specified colour as the background for highlighted
+characters. If unset, use reverse video.
+
+=item B I
+
+If set and highlightColor is set, use the specified colour as the
+foreground for highlighted characters.
+
 =item B I

 Use the specified colour for the cursor. The default is to use the
diff --git a/src/command.C b/src/command.C
index 1a0c815d8d13829e7933ef39847252d682d6749a..
index ..15cce408b68debeab24457a0450ec1d0196b313d 100644
--- a/src/command.C
+++ b/src/command.C
@@ -3396,10 +3396,12 @@ rxvt_term::process_xterm_seq (int op, char *str, char resp)
       case XTerm_Color_pointer_bg:
         process_color_seq (op, Color_pointer_bg, str, resp);
         break;
-#ifndef NO_BOLD_UNDERLINE_REVERSE
-      case XTerm_Color_RV:
-        process_color_seq (op, Color_RV, str, resp);
+#ifdef OPTION_HC
+      case XTerm_Color_HC:
+        process_color_seq (op, Color_HC, str, resp);
         break;
+#endif
+#ifndef NO_BOLD_UNDERLINE_REVERSE
       case Rxvt_Color_BD:
       case URxvt_Color_BD:
         process_color_seq (op, Color_BD, str, resp);
diff --git a/src/rxvt.h b/src/rxvt.h
index 03ee1d5c66f8c243ca28183e8b9061c3089a17cd..
index ..121fac54d67d0aeb79c523fa37eba026934d1c35 100644
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -330,6 +330,8 @@ enum {
 // toggle this to force redraw, must be != RS_Careful and otherwise "pretty neutral"
 #define RS_redraw		(2UL << RS_fontShift)

+#define RS_Sel                  (1UL << 22)
+
 // 5 custom bits for extensions
 #define RS_customCount          16UL
 #define RS_customShift          23
@@ -391,7 +393,7 @@ enum {
   XTerm_Color_pointer_bg = 14,      // change actual 'Pointer' bg color
   XTerm_Color05          = 15,      // not implemented (tektronix fg)
   XTerm_Color06          = 16,      // not implemented (tektronix bg)
-  XTerm_Color_RV         = 17,      // change actual 'Highlight' color
+  XTerm_Color_HC         = 17,      // change actual 'Highlight' color
   XTerm_logfile          = 46,      // not implemented
   XTerm_font             = 50,

diff --git a/src/rxvtfont.h b/src/rxvtfont.h
index 46896b3f1f4343ea1d8ccc86f14e2771ebc38b6e..
index ..123d5cc1b202eb101677f09f9c909977779b1304 100644
--- a/src/rxvtfont.h
+++ b/src/rxvtfont.h
@@ -68,7 +68,7 @@ struct rxvt_fontset
 {
   char *fontdesc;

-  enum { fontCount = 15 }; // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h
+  enum { fontCount =  7 }; // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h
   enum { firstFont =  2 }; // index of first font in set

   rxvt_fontset (rxvt_term *term);
diff --git a/src/screen.C b/src/screen.C
index f9099c4967a1023144edbd6d1e1b9b0ab2c33310..
index ..5c04548aa5d8860bf94fd929a8c5617d0c1a6c74 100644
--- a/src/screen.C
+++ b/src/screen.C
@@ -2288,7 +2288,7 @@ rxvt_term::scr_refresh () NOTHROW
           int back = bgcolor_of (rend); // desired background

           // only do special processing if any attributes are set, which is unlikely
-          if (expect_false (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)))
+          if (expect_false (rend & (RS_baseattrMask | RS_Careful | RS_Sel)))
             {
               bool invert = rend & RS_RVid;

@@ -2317,25 +2317,30 @@ rxvt_term::scr_refresh () NOTHROW
                 fore = Color_UL;
 #endif

-              if (invert)
-                {
 #ifdef OPTION_HC
-                  if ((showcursor && row == screen.cur.row && text - stp == screen.cur.col)
-                      || !ISSET_PIXCOLOR (Color_HC))
+              if (rend & RS_Sel)
+                {
+                  /* invert the column if no highlightColor is set or it is the
+                   * current cursor column */
+                  if (!(showcursor && row == screen.cur.row && text - stp == screen.cur.col)
+                      && ISSET_PIXCOLOR (Color_HC))
+                    {
+                      if (ISSET_PIXCOLOR (Color_HTC))
+                        fore = Color_HTC;
+                      // if invert is 0 reverse video is set so we use bg color as fg color
+                      else if (!invert)
+                        fore = back;
+                      back = Color_HC;
+                      invert = 0;
+                    }
+                }
 #endif
-                    /* invert the column if no highlightColor is set or it is the
-                     * current cursor column */
+
+              if (invert)
+                {
                     ::swap (fore, back);
-#ifdef OPTION_HC
-                  else if (ISSET_PIXCOLOR (Color_HC))
-                    back = Color_HC;
-#endif

 #ifndef NO_BOLD_UNDERLINE_REVERSE
-# ifndef OPTION_HC
-                  if (ISSET_PIXCOLOR (Color_RV))
-                    back = Color_RV;
-# endif
                   if (fore == back)
                     {
                       fore = Color_bg;
@@ -2598,12 +2603,12 @@ rxvt_term::scr_reverse_selection () NOTHROW
       if (selection.rect)
         scr_xor_rect (selection.beg.row, selection.beg.col,
                       selection.end.row, selection.end.col,
-                      RS_RVid, RS_RVid | RS_Uline);
+                      RS_Sel | RS_RVid, RS_Sel | RS_RVid | RS_Uline);
       else
 #endif
         scr_xor_span (selection.beg.row, selection.beg.col,
                       selection.end.row, selection.end.col,
-                      RS_RVid);
+                      RS_Sel | RS_RVid);
     }
 }

-----END OF PAGE-----