From e8995b83b9efb6e03c223ec92ead8275825e64d8 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Mon, 21 Dec 2015 02:43:23 +0300 Subject: [PATCH] support inverse ANSI command (IDEA-149450) --- .../process/ColoredOutputTypeRegistry.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java b/platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java index 77e314369300..b6e9db8024e6 100644 --- a/platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java +++ b/platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java @@ -100,6 +100,7 @@ public class ColoredOutputTypeRegistry { if (attribute.equals("0")) { return ProcessOutputTypes.STDOUT; } + boolean inverse = false; TextAttributes attrs = new TextAttributes(); final String[] strings = attribute.split(";"); for (String string : strings) { @@ -116,6 +117,9 @@ public class ColoredOutputTypeRegistry { else if (value == 4) { attrs.setEffectType(EffectType.LINE_UNDERSCORE); } + else if (value == 7) { + inverse = true; + } else if (value == 22) { attrs.setFontType(Font.PLAIN); } @@ -156,6 +160,19 @@ public class ColoredOutputTypeRegistry { } attrs.setEffectColor(foregroundColor); } + if (inverse) { + Color foregroundColor = attrs.getForegroundColor(); + if (foregroundColor == null) { + foregroundColor = getDefaultForegroundColor(); + } + Color backgroundColor = attrs.getBackgroundColor(); + if (backgroundColor == null) { + backgroundColor = getDefaultBackgroundColor(); + } + attrs.setForegroundColor(backgroundColor); + attrs.setEffectColor(backgroundColor); + attrs.setBackgroundColor(foregroundColor); + } Key newKey = new Key(completeAttribute); ConsoleViewContentType contentType = new ConsoleViewContentType(completeAttribute, attrs); ConsoleViewContentType.registerNewConsoleViewType(newKey, contentType); -- 2.23.3