From 26f3af90bb62aa26ec03dbc8272c570c35ff32c8 Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Mon, 30 Oct 2023 17:23:49 -0700 Subject: [PATCH 1/2] Attempt to bypass rich's color removal process when dumping to bash variable --- jrnl/output.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/output.py b/jrnl/output.py index 0230244bc..80bbcc5b9 100644 --- a/jrnl/output.py +++ b/jrnl/output.py @@ -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, no_color=False) with console.capture() as capture: console.print(richtext, sep="", end="") return capture.get() From 6c7d7923e29fecb7cf2cd41bfb4772a6987a78e1 Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Mon, 30 Oct 2023 17:42:05 -0700 Subject: [PATCH 2/2] Second try to bypass rich's color code suppression --- jrnl/output.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/output.py b/jrnl/output.py index 80bbcc5b9..48487d402 100644 --- a/jrnl/output.py +++ b/jrnl/output.py @@ -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, no_color=False) + console = Console(width=width, force_terminal=True) with console.capture() as capture: console.print(richtext, sep="", end="") return capture.get()