pretty-print.c (eat_esc_sequence): Swap the foreground and background colors if...
authorLiu Hao <lh_mouse@126.com>
Tue, 14 Aug 2018 10:04:10 +0000 (10:04 +0000)
committerJonathan Yong <jyong@gcc.gnu.org>
Tue, 14 Aug 2018 10:04:10 +0000 (10:04 +0000)
* 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

gcc/ChangeLog
gcc/pretty-print.c

index ec466dece376f1bf1a25dda97e1df82dd647efa0..1e108ef35b2c028086af9425328e475cc8141546 100644 (file)
@@ -1,3 +1,9 @@
+2018-08-13  Liu Hao <lh_mouse@126.com>
+
+       * 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 <lh_mouse@126.com>
 
        * pretty-print.c (mingw_ansi_fputs): Do not call _close() on the
index 31eb8893f2ab4ea129ac82786d371dfcb9cecb98..02967d05f75395c1eedc93fcef52a98c20788e81 100644 (file)
@@ -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;
     }