From d5cf9a8afb7c1c97fc93f255ea915cdbb88a3e28 Mon Sep 17 00:00:00 2001 From: Joanthan Bernard Date: Fri, 21 Nov 2014 16:01:00 -0600 Subject: [PATCH] Bugfix in ConsoleColor: always explicitly set boldness. Always explicitly set the bold parameter 0 for normal, 1 for bold. Once set, the text remains bold even after a color change until it is explicitly set back to normal. --- project.properties | 4 ++-- src/main/com/jdbernard/util/ConsoleColor.java | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/project.properties b/project.properties index 4139a1b..24c6503 100644 --- a/project.properties +++ b/project.properties @@ -1,6 +1,6 @@ -#Fri, 21 Nov 2014 15:09:35 -0600 +#Fri, 21 Nov 2014 15:30:57 -0600 name=jdb-util -version=3.3 +version=3.4 lib.local=true build.number=1 diff --git a/src/main/com/jdbernard/util/ConsoleColor.java b/src/main/com/jdbernard/util/ConsoleColor.java index 44ff11f..a8eab66 100644 --- a/src/main/com/jdbernard/util/ConsoleColor.java +++ b/src/main/com/jdbernard/util/ConsoleColor.java @@ -45,19 +45,16 @@ public class ConsoleColor { public String toString() { String result = "\u001b["; - boolean needSemi = false; - if (bright) { - result += "1"; - needSemi = true; } + if (bright) result += "1"; + else result += "0"; if (fg != null) { - if (needSemi) result += ";"; - result += "3" + Integer.toString(fg.ordinal()); - needSemi = true; } + result += ";"; + result += "3" + Integer.toString(fg.ordinal()); } if (bg != null) { - if (needSemi) result += ";"; + result += ";"; result += "4" + Integer.toString(bg.ordinal()); } return result + "m";