summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Knoepfel <knoepfel@fnal.gov>2024-10-24 11:11:43 +0200
committerGitHub <noreply@github.com>2024-10-24 09:11:43 +0000
commite0eea48ccff37023e2d9e48067baece8dee80916 (patch)
treec87c18526ba477093a1f17407caabdc16e1a79a9
parent61cbfc1da060c078e7219fbd61ff674eb36969ae (diff)
downloadspack-e0eea48ccff37023e2d9e48067baece8dee80916.tar.gz
spack-e0eea48ccff37023e2d9e48067baece8dee80916.tar.bz2
spack-e0eea48ccff37023e2d9e48067baece8dee80916.tar.xz
spack-e0eea48ccff37023e2d9e48067baece8dee80916.zip
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 <tgamblin@llnl.gov>
-rw-r--r--lib/spack/llnl/util/tty/color.py4
1 files changed, 3 insertions, 1 deletions
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: