XFree86 3.1.2F - xterm patch #28 - T.Dickey This patch corrects the following reported by Roland Rosenfeld : + handle SGR 22, 24 and 25 in combination with colorUL and colorBD resources. Also noted & fixed reset of colored underline/bold with SGR 0. + a typo in the termcap (missing '['), from 3.1.2Dj (my error) Roland also complained that he couldn't use box characters with -adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1 but that's a known xterm limitation (the box characters must be part of the font, in the first 32 locations). -------------------------------------------------------------------------------- charproc.c | 103 +++++++++++++++++++++++++++++++++++++++++------------------ termcap | 2 - 2 files changed, 74 insertions, 31 deletions -------------------------------------------------------------------------------- Index: charproc.c --- xterm-27+/charproc.c Fri Aug 23 12:47:18 1996 +++ xterm-28/charproc.c Sat Aug 31 14:14:17 1996 @@ -151,6 +151,13 @@ #define StopBlinking(screen) /* nothing */ #endif +#if OPT_ISO_COLORS +static void clrColorBD PROTO((void)); +static void clrColorUL PROTO((void)); +static void setColorBD PROTO((void)); +static void setColorUL PROTO((void)); +#endif + #define DEFAULT -1 #define TEXT_BUF_SIZE 256 #define TRACKTIMESEC 4L @@ -777,6 +784,55 @@ XSetBackground(screen->display, screen->normalboldGC, bg); XSetForeground(screen->display, screen->reverseboldGC, bg); } + +static void +setColorBD() +{ + if (term->screen.colorBDMode) { + if (!(term->flags & FG_COLOR) + || (term->cur_foreground == COLOR_UL)) { + SGR_Foreground(COLOR_BD); + } else if (term->cur_foreground < 8) { /* Set highlight bit */ + SGR_Foreground(term->cur_foreground | 8); + } + } +} + +static void +clrColorBD() +{ + if (term->screen.colorBDMode + && term->flags & BOLD + && !(term->flags & FG_COLOR)) { + if (term->cur_foreground == COLOR_BD) + SGR_Foreground(-1); + else if ((term->cur_foreground >= 8) + && (term->cur_foreground <= 15)) + SGR_Foreground(term->cur_foreground & 7); + } +} + +static void +setColorUL() +{ + if (term->screen.colorULMode + && !(term->flags & FG_COLOR)) + SGR_Foreground(COLOR_UL); +} + +static void +clrColorUL() +{ + if (term->screen.colorULMode + && term->cur_foreground == COLOR_UL) { + if (term->screen.colorBDMode + && (term->flags & BOLD)) + SGR_Foreground(COLOR_BD); + else + SGR_Foreground(-1); + } +} + #endif /* OPT_ISO_COLORS */ static void VTparse() @@ -1186,39 +1242,26 @@ switch (param[row]) { case DEFAULT: case 0: - if_OPT_ISO_COLORS(screen,{ - if (term->flags & FG_COLOR) - SGR_Foreground(-1); - if (term->flags & BG_COLOR) - SGR_Background(-1); - }) term->flags &= ~(INVERSE|BOLD|UNDERLINE|INVISIBLE); + if_OPT_ISO_COLORS(screen,{ + clrColorBD(); /* first */ + clrColorUL(); /* second */ + if (term->flags & FG_COLOR) + SGR_Foreground(-1); + if (term->flags & BG_COLOR) + SGR_Background(-1); + }) break; - case 1: + case 1: /* Bold */ + /* FALLTHRU */ case 5: /* Blink, really. */ term->flags |= BOLD; - if_OPT_ISO_COLORS(screen,{ - if (screen->colorBDMode) { - if (!(term->flags & FG_COLOR) || - (term->cur_foreground==COLOR_UL)){ - SGR_Foreground(COLOR_BD); - } - else /* Set highlight bit */ - if (term->cur_foreground < 8) - term->cur_foreground |= 8; - } - }) + if_OPT_ISO_COLORS(screen,{setColorBD();}) break; case 4: /* Underscore */ term->flags |= UNDERLINE; - if_OPT_ISO_COLORS(screen,{ - if (screen->colorULMode) { - if (!(term->flags & FG_COLOR)) { - SGR_Foreground(COLOR_UL); - } - } - }) + if_OPT_ISO_COLORS(screen,{setColorUL();}) break; case 7: term->flags |= INVERSE; @@ -1226,14 +1269,14 @@ case 8: term->flags |= INVISIBLE; break; - case 22: - term->flags &= ~BOLD; - break; case 24: + if_OPT_ISO_COLORS(screen,{clrColorUL();}) term->flags &= ~UNDERLINE; break; - case 25: - /* Blink, really */ + case 22: /* reset 'bold' */ + /* FALLTHRU */ + case 25: /* reset 'blink' */ + if_OPT_ISO_COLORS(screen,{clrColorBD();}) term->flags &= ~BOLD; break; case 27: Index: termcap --- xterm-27+/termcap Sat Aug 10 14:59:48 1996 +++ xterm-28/termcap Sat Aug 31 08:00:51 1996 @@ -38,7 +38,7 @@ :ti=\E7\E[?47h:te=\E[2J\E[?47l\E8:\ :vi=\E[?25l:ve=\E[?25h:\ :up=\E[A:us=\E[4m:ue=\E[24m:xn:\ - :ut:Co#8:op=\E100m:AB=\E[4%dm:AF=\E[3%dm: + :ut:Co#8:op=\E[100m:AB=\E[4%dm:AF=\E[3%dm: v2|xterm-65|xterm with tall window 65x80 (X Window System):\ :li#65:tc=xterm: vb|xterm-bold|xterm with bold instead of underline (X Window System):\