From 6ed371c912ca6203f6c7eb558fd215e56d1ba25b Mon Sep 17 00:00:00 2001 From: mattirn Date: Fri, 29 Jan 2021 15:55:12 +0100 Subject: [PATCH] SystemRegistryImpl: highlight customization improvement --- .../org/jline/console/impl/SystemRegistryImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/console/src/main/java/org/jline/console/impl/SystemRegistryImpl.java b/console/src/main/java/org/jline/console/impl/SystemRegistryImpl.java index 1c6429e14..e41f86625 100644 --- a/console/src/main/java/org/jline/console/impl/SystemRegistryImpl.java +++ b/console/src/main/java/org/jline/console/impl/SystemRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2020, the original author or authors. + * Copyright (c) 2002-2021, the original author or authors. * * This software is distributable under the BSD license. See the terms of the * BSD license in the documentation provided with this software. @@ -1276,19 +1276,19 @@ public void trace(boolean stack, Exception exception) { Options.HelpException.highlight((exception).getMessage(), Styles.helpStyle()).print(terminal()); } else if (exception instanceof UnknownCommandException) { AttributedStringBuilder asb = new AttributedStringBuilder(); - asb.append(exception.getMessage(), AttributedStyle.DEFAULT.foreground(AttributedStyle.RED)); + asb.append(exception.getMessage(), Styles.prntStyle().resolve(".em")); asb.toAttributedString().println(terminal()); } else if (stack) { exception.printStackTrace(); } else { String message = exception.getMessage(); AttributedStringBuilder asb = new AttributedStringBuilder(); + asb.style(Styles.prntStyle().resolve(".em")); if (message != null) { - String m = exception.getClass().getSimpleName() + ": " + message; - asb.append(m, AttributedStyle.DEFAULT.foreground(AttributedStyle.RED)); + asb.append(exception.getClass().getSimpleName()).append(": ").append(message); } else { - asb.append("Caught exception: ", AttributedStyle.DEFAULT.foreground(AttributedStyle.RED)); - asb.append(exception.getClass().getCanonicalName(), AttributedStyle.DEFAULT.foreground(AttributedStyle.RED)); + asb.append("Caught exception: "); + asb.append(exception.getClass().getCanonicalName()); } asb.toAttributedString().println(terminal()); Log.debug("Stack: ", exception);