From: Liu Hao Date: Tue, 14 Aug 2018 10:04:10 +0000 (+0000) Subject: pretty-print.c (eat_esc_sequence): Swap the foreground and background colors if... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5d3083dde2a4fb03fab20d66fda1a5881801c757;p=gcc.git pretty-print.c (eat_esc_sequence): Swap the foreground and background colors if... * gcc/pretty-print.c (eat_esc_sequence): Swap the foreground and background colors if the COMMON_LVB_REVERSE_VIDEO flag is set, and clear it thereafter, as it only works for DBCS. From-SVN: r263531 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec466dece37..1e108ef35b2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-08-13 Liu Hao + + * pretty-print.c (eat_esc_sequence): Swap the foreground and + background colors if the COMMON_LVB_REVERSE_VIDEO flag is set, + and clear it thereafter, as it only works for DBCS. + 2018-08-13 Liu Hao * pretty-print.c (mingw_ansi_fputs): Do not call _close() on the diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index 31eb8893f2a..02967d05f75 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -640,6 +640,16 @@ sgr_set_it: { attrib_add |= sb.wAttributes & ~attrib_rm; } + if (attrib_add & COMMON_LVB_REVERSE_VIDEO) + { + /* COMMON_LVB_REVERSE_VIDEO is only effective for DBCS. + * Swap foreground and background colors by hand. + */ + attrib_add = (attrib_add & 0xFF00) + | ((attrib_add & 0x00F0) >> 4) + | ((attrib_add & 0x000F) << 4); + attrib_add &= ~COMMON_LVB_REVERSE_VIDEO; + } SetConsoleTextAttribute (h, attrib_add); break; }