From e0d7c4885ae95581b8ec33f80ccbf3cfb7e4eb0e Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Thu, 10 Nov 2022 22:21:40 -0500 Subject: [PATCH] [F] Fix issues cause by terminal size too small --- hyfetch/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hyfetch/main.py b/hyfetch/main.py index 150f5cc9..c7c6edd2 100755 --- a/hyfetch/main.py +++ b/hyfetch/main.py @@ -233,9 +233,9 @@ def create_config() -> Config: print() # Print cats - num_cols = term_size()[0] // (TEST_ASCII_WIDTH + 2) + num_cols = (term_size()[0] // (TEST_ASCII_WIDTH + 2)) or 1 mn, mx = 0.15, 0.85 - ratios = [col / (num_cols - 1) for col in range(num_cols)] + ratios = [col / num_cols for col in range(num_cols)] ratios = [(r * (mx - mn) / 2 + mn) if is_light else ((r * (mx - mn) + (mx + mn)) / 2) for r in ratios] lines = [ColorAlignment('horizontal').recolor_ascii(TEST_ASCII.replace( '{txt}', f'{r * 100:.0f}%'.center(5)), _prs.set_light_dl(r, light_dark)).split('\n') for r in ratios] @@ -270,7 +270,7 @@ def create_config() -> Config: fore_back = get_fore_back() # Calculate amount of row/column that can be displayed on screen - ascii_per_row = term_size()[0] // (asc_width + 2) + ascii_per_row = max(1, term_size()[0] // (asc_width + 2)) ascii_rows = max(1, (term_size()[1] - 8) // asc_lines) # Displays horizontal and vertical arrangements in the first iteration, but hide them in