From 5294c8728929f8c97c373141227242df8bfe7e1b Mon Sep 17 00:00:00 2001 From: Joseph Choi Date: Wed, 15 Nov 2017 12:06:59 +0800 Subject: [PATCH] Correct support for the bright colors on windows - regression fix --- .../org/fusesource/jansi/WindowsAnsiOutputStream.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jansi/src/main/java/org/fusesource/jansi/WindowsAnsiOutputStream.java b/jansi/src/main/java/org/fusesource/jansi/WindowsAnsiOutputStream.java index fd8acc0d..42df829f 100644 --- a/jansi/src/main/java/org/fusesource/jansi/WindowsAnsiOutputStream.java +++ b/jansi/src/main/java/org/fusesource/jansi/WindowsAnsiOutputStream.java @@ -244,14 +244,18 @@ protected void processCursorToColumn(int x) throws IOException { @Override protected void processSetForegroundColor(int color, boolean bright) throws IOException { info.attributes = (short) ((info.attributes & ~0x0007) | ANSI_FOREGROUND_COLOR_MAP[color]); - info.attributes = (short) ((info.attributes & ~FOREGROUND_INTENSITY) | (bright ? FOREGROUND_INTENSITY : 0)); + if (bright) { + info.attributes |= FOREGROUND_INTENSITY; + } applyAttribute(); } @Override protected void processSetBackgroundColor(int color, boolean bright) throws IOException { info.attributes = (short) ((info.attributes & ~0x0070) | ANSI_BACKGROUND_COLOR_MAP[color]); - info.attributes = (short) ((info.attributes & ~BACKGROUND_INTENSITY) | (bright ? BACKGROUND_INTENSITY : 0)); + if (bright) { + info.attributes |= BACKGROUND_INTENSITY; + } applyAttribute(); }