Restore bold uncolored font face (#47108)

Commit aa0825d642 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>
This commit is contained in:
Kyle Knoepfel 2024-10-24 11:11:43 +02:00 committed by GitHub
parent 61cbfc1da0
commit e0eea48ccf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -263,7 +263,9 @@ def match_to_ansi(match):
f"Incomplete color format: '{match.group(0)}' in '{match.string}'" 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: if text:
return f"{ansi_code}{text}{_escape(0, color, enclose, zsh)}" return f"{ansi_code}{text}{_escape(0, color, enclose, zsh)}"
else: else: