From 0ff37d0679c9b060353c1db3a8be6edf1663081c Mon Sep 17 00:00:00 2001 From: JustinOros Date: Wed, 6 Aug 2025 14:19:16 -0700 Subject: [PATCH] Resize output horizontally and vertically based on current terminal size. --- topless.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/topless.py b/topless.py index 39bdd9b..a048519 100644 --- a/topless.py +++ b/topless.py @@ -194,14 +194,14 @@ def main(): config = load_or_create_config() use_color = not args.no_color show_line_numbers = args.lines - term_height = get_terminal_size().lines - limit = args.n if args.n else max(5, term_height - 10) sort_key = 'cpu' reverse = True refresh_count = 0 start_time = time.time() while True: + term_height = get_terminal_size().lines + limit = args.n if args.n else max(1, term_height - 3) elapsed = time.time() - start_time show_quit = True print_processes(limit, sort_key, reverse, show_quit, use_color, show_line_numbers, config=config)