From: jyong Date: Tue, 14 Aug 2018 10:04:10 +0000 (+0000) Subject: * gcc/pretty-print.c (eat_esc_sequence): Swap the foreground and background X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6461f5a2e10fa5983e8467d3f4f0b9374c1aea36;p=thirdparty%2Fgcc.git * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263531 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec466dece376..1e108ef35b2c 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 31eb8893f2ab..02967d05f753 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; }