From 85c4cad1acd8b0a6edee424e575f3be5d5ed003b Mon Sep 17 00:00:00 2001 From: root Date: Sat, 31 Dec 2005 16:40:28 +0000 Subject: [PATCH] *** empty log message *** --- src/command.C | 2 +- src/rxvt.h | 41 ++++++++++++++++++++++++----------------- src/rxvtlib.h.in | 1 + src/screen.C | 10 +++++----- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/command.C b/src/command.C index ba1ece3a..4a7af107 100644 --- a/src/command.C +++ b/src/command.C @@ -191,7 +191,7 @@ rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s", (int)r, - GET_FGCOLOR (r), GET_BGCOLOR (r), + fgcolor_of (r), bgcolor_of (r), r & RS_Bold ? " bold" : "", r & RS_Italic ? " italic" : "", r & RS_Blink ? " blink" : "", diff --git a/src/rxvt.h b/src/rxvt.h index 432da3b3..dfd10634 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -829,23 +829,6 @@ enum { /* how to build & extract colors and attributes */ #define GET_BASEFG(x) (((x) & RS_fgMask)) #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) -#ifndef NO_BRIGHTCOLOR -# define GET_FGCOLOR(x) ( \ - !((x) & RS_Bold) \ - || (ENABLE_STYLES && !(options & Opt_intensityStyles)) \ - || !IN_RANGE_INC (GET_BASEFG (x), minCOLOR, minBrightCOLOR) \ - ? GET_BASEFG (x) \ - : (GET_BASEFG (x) + (minBrightCOLOR - minCOLOR))) -# define GET_BGCOLOR(x) ( \ - !((x) & RS_Blink) \ - || (ENABLE_STYLES && !(options & Opt_intensityStyles)) \ - || !IN_RANGE_INC (GET_BASEBG (x), minCOLOR, minBrightCOLOR) \ - ? GET_BASEBG (x) \ - : (GET_BASEBG (x) + (minBrightCOLOR - minCOLOR))) -#else -# define GET_FGCOLOR(x) GET_BASEFG(x) -# define GET_BGCOLOR(x) GET_BASEBG(x) -#endif #define GET_FONT(x) (((x) & RS_fontMask) >> RS_fontShift) #define SET_FONT(x,fid) (((x) & ~RS_fontMask) | ((fid) << RS_fontShift)) @@ -1497,6 +1480,30 @@ struct rxvt_term : zero_initialized, rxvt_vars { scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE); } + int fgcolor_of (rend_t r) + { + int base = GET_BASEFG (r); +#ifndef NO_BRIGHTCOLOR + if (r & RS_Bold + && (!ENABLE_STYLES || options & Opt_intensityStyles) + && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) + base += minBrightCOLOR - minCOLOR; +#endif + return base; + } + + int bgcolor_of (rend_t r) + { + int base = GET_BASEBG (r); +#ifndef NO_BRIGHTCOLOR + if (r & RS_Blink + && (!ENABLE_STYLES || options & Opt_intensityStyles) + && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) + base += minBrightCOLOR - minCOLOR; +#endif + return base; + } + void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs); void scr_blank_screen_mem (line_t &l, rend_t efs); int scr_scroll_text (int row1, int row2, int count); diff --git a/src/rxvtlib.h.in b/src/rxvtlib.h.in index d395b59d..d5cb975b 100644 --- a/src/rxvtlib.h.in +++ b/src/rxvtlib.h.in @@ -270,6 +270,7 @@ typedef struct { #define Opt_Reverse (1UL<<30) #define Opt_Boolean (1UL<<31) +#define OPTION(opt) (options && (opt)) #define DEFAULT_OPTIONS (Opt_scrollBar | Opt_scrollTtyOutput \ | Opt_jumpScroll | Opt_secondaryScreen \ | Opt_pastableTabs | Opt_intensityStyles) diff --git a/src/screen.C b/src/screen.C index e876b2fe..5b2d93dd 100644 --- a/src/screen.C +++ b/src/screen.C @@ -1286,7 +1286,7 @@ rxvt_term::scr_erase_screen (int mode) else { ren = rstyle & (RS_fgMask | RS_bgMask); - gcvalue.foreground = pix_colors[GET_BGCOLOR (rstyle)]; + gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; XChangeGC (display->display, gc, GCForeground, &gcvalue); ERASE_ROWS (row, num); gcvalue.foreground = pix_colors[Color_fg]; @@ -1990,7 +1990,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) ccol1 = Color_cursor; else #ifdef CURSOR_COLOR_IS_RENDITION_COLOR - ccol1 = GET_FGCOLOR (rstyle); + ccol1 = fgcolor_of (rstyle); #else ccol1 = Color_fg; #endif @@ -1998,7 +1998,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) ccol2 = Color_cursor2; else #ifdef CURSOR_COLOR_IS_RENDITION_COLOR - ccol2 = GET_BGCOLOR (rstyle); + ccol2 = bgcolor_of (rstyle); #else ccol2 = Color_bg; #endif @@ -2189,8 +2189,8 @@ rxvt_term::scr_refresh (unsigned char refresh_type) /* * Determine the attributes for the string */ - int fore = GET_FGCOLOR (rend); // desired foreground - int back = GET_BGCOLOR (rend); // desired background + int fore = fgcolor_of (rend); // desired foreground + int back = bgcolor_of (rend); // desired background // only do special processing if any attributes are set, which is unlikely if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) -- 2.34.1