From 109dffb2428b91a1220d7baef4a91cbeee031b7b Mon Sep 17 00:00:00 2001 From: teknium1 Date: Thu, 19 Feb 2026 01:53:36 -0800 Subject: [PATCH] fix: refine dynamic height adjustment for input area in CLI - Updated the input area height calculation to ensure it matches the exact line count of content, eliminating extra blank space. - Adjusted the return values to improve the responsiveness of the input area, enhancing user experience when adding newlines. --- cli.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cli.py b/cli.py index 31f011dc6..c4fcdacab 100755 --- a/cli.py +++ b/cli.py @@ -1651,16 +1651,16 @@ class HermesCLI: complete_while_typing=True, ) - # Dynamic height: grow the input area to match content lines so - # newlines (Alt+Enter) are always visible. A static preferred=1 - # causes the widget to stay 1-line and scroll internally after - # patch_stdout output has filled the terminal. + # Dynamic height: return the exact line count so the TextArea is + # always exactly as tall as its content -- no extra blank space. + # The bottom rule sits directly below the last line of text and + # pushes down only when the user adds a newline. def _input_height(): try: lines = input_area.buffer.document.line_count - return Dimension(min=1, max=8, preferred=max(lines, 1)) + return min(max(lines, 1), 8) except Exception: - return Dimension(min=1, max=8, preferred=1) + return 1 input_area.window.height = _input_height