fix(cli): Ctrl+C clears input buffer before exiting
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.
This commit is contained in:
9
cli.py
9
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):
|
||||
|
||||
Reference in New Issue
Block a user