From 340ebe29b997e87c914eab736b0d03a78715f547 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 1 Jun 2018 13:26:07 +0200 Subject: [PATCH] Fix dark gray problem on windows, fixes #277 --- .../org/jline/terminal/impl/jansi/win/WindowsAnsiWriter.java | 4 ++-- .../org/jline/terminal/impl/jna/win/WindowsAnsiWriter.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terminal-jansi/src/main/java/org/jline/terminal/impl/jansi/win/WindowsAnsiWriter.java b/terminal-jansi/src/main/java/org/jline/terminal/impl/jansi/win/WindowsAnsiWriter.java index bd9820990..d2817057d 100644 --- a/terminal-jansi/src/main/java/org/jline/terminal/impl/jansi/win/WindowsAnsiWriter.java +++ b/terminal-jansi/src/main/java/org/jline/terminal/impl/jansi/win/WindowsAnsiWriter.java @@ -268,7 +268,7 @@ protected void processCursorToColumn(int x) throws IOException { protected void processSetForegroundColorExt(int paletteIndex) throws IOException { int color = Colors.roundColor(paletteIndex, 16); info.attributes = (short) ((info.attributes & ~0x0007) | ANSI_FOREGROUND_COLOR_MAP[color & 0x07]); - info.attributes = (short) ((info.attributes & ~FOREGROUND_INTENSITY) | (color > 8 ? FOREGROUND_INTENSITY : 0)); + info.attributes = (short) ((info.attributes & ~FOREGROUND_INTENSITY) | (color >= 8 ? FOREGROUND_INTENSITY : 0)); applyAttribute(); } @@ -276,7 +276,7 @@ protected void processSetForegroundColorExt(int paletteIndex) throws IOException protected void processSetBackgroundColorExt(int paletteIndex) throws IOException { int color = Colors.roundColor(paletteIndex, 16); info.attributes = (short) ((info.attributes & ~0x0070) | ANSI_BACKGROUND_COLOR_MAP[color & 0x07]); - info.attributes = (short) ((info.attributes & ~BACKGROUND_INTENSITY) | (color > 8 ? BACKGROUND_INTENSITY : 0)); + info.attributes = (short) ((info.attributes & ~BACKGROUND_INTENSITY) | (color >= 8 ? BACKGROUND_INTENSITY : 0)); applyAttribute(); } diff --git a/terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/WindowsAnsiWriter.java b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/WindowsAnsiWriter.java index c3a2257de..c3bb37c6b 100644 --- a/terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/WindowsAnsiWriter.java +++ b/terminal-jna/src/main/java/org/jline/terminal/impl/jna/win/WindowsAnsiWriter.java @@ -247,14 +247,14 @@ protected void processCursorToColumn(int x) throws IOException { protected void processSetForegroundColorExt(int paletteIndex) throws IOException { int color = Colors.roundColor(paletteIndex, 16); info.wAttributes = (short) ((info.wAttributes & ~0x0007) | ANSI_FOREGROUND_COLOR_MAP[color & 0x07]); - info.wAttributes = (short) ((info.wAttributes & ~FOREGROUND_INTENSITY) | (color > 8 ? FOREGROUND_INTENSITY : 0)); + info.wAttributes = (short) ((info.wAttributes & ~FOREGROUND_INTENSITY) | (color >= 8 ? FOREGROUND_INTENSITY : 0)); applyAttribute(); } protected void processSetBackgroundColorExt(int paletteIndex) throws IOException { int color = Colors.roundColor(paletteIndex, 16); info.wAttributes = (short)((info.wAttributes & ~0x0070 ) | ANSI_BACKGROUND_COLOR_MAP[color & 0x07]); - info.wAttributes = (short) ((info.wAttributes & ~BACKGROUND_INTENSITY) | (color > 8 ? BACKGROUND_INTENSITY : 0)); + info.wAttributes = (short) ((info.wAttributes & ~BACKGROUND_INTENSITY) | (color >= 8 ? BACKGROUND_INTENSITY : 0)); applyAttribute(); }