Force rich to use color codes when pretty printing (#1821)

This commit is contained in:
Micah Jerome Ellison 2023-10-30 18:25:49 -07:00 committed by GitHub
parent c2a97f3100
commit cf145123f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,7 +136,7 @@ def format_msg_text(msg: Message) -> Text:
def wrap_with_ansi_colors(text: str, width: int) -> str:
richtext = Text.from_ansi(text, no_wrap=False, tab_size=None)
console = Console(width=width)
console = Console(width=width, force_terminal=True)
with console.capture() as capture:
console.print(richtext, sep="", end="")
return capture.get()