From b67cf4c1bdb7c36e2f1e7b498f487b2c8f38b89c Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 13 Apr 2026 13:35:31 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20fill=20full=20terminal=20width=20?= =?UTF-8?q?=E2=80=94=20pad=20all=20lines=20to=20cols?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every line now pads to the full terminal width so there are no gaps. Empty lines below content are filled with spaces. Co-Authored-By: Claude Opus 4.6 (1M context) --- briefing | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/briefing b/briefing index 0aa831d..fc9dee2 100755 --- a/briefing +++ b/briefing @@ -550,20 +550,34 @@ def tui_viewer(range_days, client): def split_lines(content): return content.split('\n') + ANSI_ESC = re.compile(r'\x1b\[[0-9;]*m') + + def visible_len(s): + """Length of string excluding ANSI escape codes.""" + return len(ANSI_ESC.sub('', s)) + def render(): rows, cols = get_terminal_size() view_height = rows - 1 # bottom row = status bar - # Move cursor to top-left, clear screen - out = '\033[H\033[2J' + # Move cursor to top-left + out = '\033[H' for i in range(view_height): line_idx = scroll + i + out += f'\033[{i+1};1H' if line_idx < len(lines): line = lines[line_idx] - out += f'\033[{i+1};1H{line}\033[K' + # Pad line to fill terminal width + pad = cols - visible_len(line) + if pad > 0: + out += line + ' ' * pad + else: + out += line else: - out += f'\033[{i+1};1H\033[K' + # Empty line — fill with spaces + out += ' ' * cols + out += '\033[0m' # Status bar (bottom row, reverse video) if input_mode: