feat: enhance input area height adjustment in CLI
- Implemented dynamic height adjustment for the input area in HermesCLI to accommodate varying content lines, ensuring that newlines (Alt+Enter) remain visible. - This change improves usability by preventing internal scrolling of the input area when displaying output from the agent.
This commit is contained in:
parent
a4bc6f73d7
commit
ac0a70b369
1 changed files with 13 additions and 0 deletions
13
cli.py
13
cli.py
|
|
@ -1632,6 +1632,19 @@ class HermesCLI:
|
||||||
complete_while_typing=True,
|
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.
|
||||||
|
def _input_height():
|
||||||
|
try:
|
||||||
|
lines = input_area.buffer.document.line_count
|
||||||
|
return Dimension(min=1, max=8, preferred=max(lines, 1))
|
||||||
|
except Exception:
|
||||||
|
return Dimension(min=1, max=8, preferred=1)
|
||||||
|
|
||||||
|
input_area.window.height = _input_height
|
||||||
|
|
||||||
# Paste collapsing: detect large pastes and save to temp file
|
# Paste collapsing: detect large pastes and save to temp file
|
||||||
_paste_counter = [0]
|
_paste_counter = [0]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue