mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(cli): keep Ctrl+D no-op when only attachments pending
Follow-up to @iRonin's Ctrl+D EOF fix. If the input text is empty but the user has pending attached images, do nothing rather than exiting — otherwise a stray Ctrl+D silently discards the attachments.
This commit is contained in:
parent
08d5c9c539
commit
ed91b79b7e
1 changed files with 6 additions and 1 deletions
7
cli.py
7
cli.py
|
|
@ -9558,11 +9558,16 @@ class HermesCLI:
|
||||||
@kb.add('c-d')
|
@kb.add('c-d')
|
||||||
def handle_ctrl_d(event):
|
def handle_ctrl_d(event):
|
||||||
"""Ctrl+D: delete char under cursor (standard readline behaviour).
|
"""Ctrl+D: delete char under cursor (standard readline behaviour).
|
||||||
Only exit when the input is empty — same as bash/zsh.
|
Only exit when the input is empty — same as bash/zsh. Pending
|
||||||
|
attached images count as input and block the EOF-exit so the
|
||||||
|
user doesn't lose them silently.
|
||||||
"""
|
"""
|
||||||
buf = event.app.current_buffer
|
buf = event.app.current_buffer
|
||||||
if buf.text:
|
if buf.text:
|
||||||
buf.delete()
|
buf.delete()
|
||||||
|
elif self._attached_images:
|
||||||
|
# Empty text but pending attachments — no-op, don't exit.
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
self._should_exit = True
|
self._should_exit = True
|
||||||
event.app.exit()
|
event.app.exit()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue