From ed91b79b7ecad032b5a167c1b6f5404db5a7e38a Mon Sep 17 00:00:00 2001 From: Teknium Date: Fri, 24 Apr 2026 15:15:41 -0700 Subject: [PATCH] fix(cli): keep Ctrl+D no-op when only attachments pending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- cli.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index 371b6760c..0b1bafe53 100644 --- a/cli.py +++ b/cli.py @@ -9558,11 +9558,16 @@ class HermesCLI: @kb.add('c-d') def handle_ctrl_d(event): """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 if buf.text: buf.delete() + elif self._attached_images: + # Empty text but pending attachments — no-op, don't exit. + return else: self._should_exit = True event.app.exit()