From e0eea48ccff37023e2d9e48067baece8dee80916 Mon Sep 17 00:00:00 2001 From: Kyle Knoepfel Date: Thu, 24 Oct 2024 11:11:43 +0200 Subject: Restore bold uncolored font face (#47108) Commit aa0825d642cfa285f5f62761a0e23dc1e511d056 accidentally added a semicolon to the ANSI escape sequence even if the color code was `None` or unknown, breaking the bold, uncolored font-face. This PR restores the old behavior. --------- Co-authored-by: Todd Gamblin --- lib/spack/llnl/util/tty/color.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/spack/llnl/util/tty/color.py b/lib/spack/llnl/util/tty/color.py index 710196783d..51a5a1b5b1 100644 --- a/lib/spack/llnl/util/tty/color.py +++ b/lib/spack/llnl/util/tty/color.py @@ -263,7 +263,9 @@ def colorize( f"Incomplete color format: '{match.group(0)}' in '{match.string}'" ) - ansi_code = _escape(f"{styles[style]};{colors.get(color_code, '')}", color, enclose, zsh) + color_number = colors.get(color_code, "") + semi = ";" if color_number else "" + ansi_code = _escape(f"{styles[style]}{semi}{color_number}", color, enclose, zsh) if text: return f"{ansi_code}{text}{_escape(0, color, enclose, zsh)}" else: -- cgit v1.2.3-70-g09d2