From 9079a2781421b3d1ba3e0dc240c5bed1097b293b Mon Sep 17 00:00:00 2001 From: dmahan93 Date: Mon, 2 Mar 2026 21:53:25 -0600 Subject: [PATCH] fix: prompt box and response box span full terminal width on wide screens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace hardcoded '─' * 200 horizontal rules with Window(char='─') so prompt_toolkit fills the entire terminal width automatically - Use shutil.get_terminal_size().columns instead of Rich Console.width for response box, separator line, and input height calculation (more reliable inside patch_stdout context) --- cli.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cli.py b/cli.py index 0389eed5..599b4435 100755 --- a/cli.py +++ b/cli.py @@ -2144,7 +2144,8 @@ class HermesCLI: # Add user message to history self.conversation_history.append({"role": "user", "content": message}) - w = self.console.width + import shutil as _shutil + w = _shutil.get_terminal_size().columns _cprint(f"{_GOLD}{'─' * w}{_RST}") print(flush=True) @@ -2220,7 +2221,7 @@ class HermesCLI: response = response + "\n\n---\n_[Interrupted - processing new message]_" if response: - w = self.console.width + w = _shutil.get_terminal_size().columns label = " ⚕ Hermes " fill = w - 2 - len(label) # 2 for ╭ and ╮ top = f"{_GOLD}╭─{label}{'─' * max(fill - 1, 0)}╮{_RST}" @@ -2540,7 +2541,8 @@ class HermesCLI: def _input_height(): try: doc = input_area.buffer.document - available_width = (cli_ref.console.width or 80) - 4 # subtract prompt width + import shutil as _shutil + available_width = _shutil.get_terminal_size().columns - 4 # subtract prompt width if available_width < 10: available_width = 40 visual_lines = 0 @@ -2801,13 +2803,17 @@ class HermesCLI: # Horizontal rules above and below the input (bronze, 1 line each). # The bottom rule moves down as the TextArea grows with newlines. + # Using char='─' instead of hardcoded repetition so the rule + # always spans the full terminal width on any screen size. input_rule_top = Window( - content=FormattedTextControl([('class:input-rule', '─' * 200)]), + char='─', height=1, + style='class:input-rule', ) input_rule_bot = Window( - content=FormattedTextControl([('class:input-rule', '─' * 200)]), + char='─', height=1, + style='class:input-rule', ) # Layout: interactive prompt widgets + ruled input at bottom.