From 078e2e4b19effc7ae4d8a4ff2398344e4eefff44 Mon Sep 17 00:00:00 2001 From: teknium1 Date: Wed, 4 Mar 2026 22:01:13 -0800 Subject: [PATCH] fix(cli): Ctrl+C clears input buffer before exiting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, pressing Ctrl+C while text was typed in the input prompt would immediately exit Hermes. Now follows standard shell behavior: - Text in buffer → Ctrl+C clears the line (like bash) - Empty buffer → Ctrl+C exits This means accidentally hitting Ctrl+C while composing a message just clears the input instead of killing the session. A second Ctrl+C on the empty prompt still exits as expected. --- cli.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cli.py b/cli.py index 417d9f648..6c05b6b1e 100755 --- a/cli.py +++ b/cli.py @@ -2490,8 +2490,13 @@ class HermesCLI: print("\n⚔ Interrupting agent... (press Ctrl+C again to force exit)") self.agent.interrupt() else: - self._should_exit = True - event.app.exit() + # If there's text in the input buffer, clear it (like bash). + # If the buffer is already empty, exit. + if event.app.current_buffer.text: + event.app.current_buffer.reset() + else: + self._should_exit = True + event.app.exit() @kb.add('c-d') def handle_ctrl_d(event):