From f79fd45ff85cedd024a4f4ef8f33af199cbd77c3 Mon Sep 17 00:00:00 2001 From: Justin Bollinger Date: Tue, 3 Feb 2026 17:01:57 -0500 Subject: [PATCH] updated formatting to take account terminal width --- hate_crack/formatting.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hate_crack/formatting.py b/hate_crack/formatting.py index 457706b..08a6aaa 100644 --- a/hate_crack/formatting.py +++ b/hate_crack/formatting.py @@ -3,9 +3,18 @@ import os def _terminal_width(default: int = 120) -> int: try: - return os.get_terminal_size().columns + width = os.get_terminal_size().columns + if width: + return width except Exception: - return default + pass + try: + width = int(os.environ.get("COLUMNS", "")) + if width > 0: + return width + except Exception: + pass + return default def print_multicolumn_list(title, entries, min_col_width=20, max_col_width=None):