From: sf-exg Date: Sat, 17 Apr 2010 23:00:45 +0000 (+0000) Subject: Disable colorRV resource. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=4385bfc741b793fac4b0a70098c07ae21a77aa6f;p=dana%2Furxvt.git 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 819f1ec9..b6efa55a 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 1a0c815d..15cce408 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 03ee1d5c..121fac54 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 46896b3f..123d5cc1 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 f9099c49..5c04548a 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); } }