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:
parent
9aa2999388
commit
078e2e4b19
1 changed files with 7 additions and 2 deletions
5
cli.py
5
cli.py
|
|
@ -2489,6 +2489,11 @@ class HermesCLI:
|
||||||
self._last_ctrl_c_time = now
|
self._last_ctrl_c_time = now
|
||||||
print("\n⚡ Interrupting agent... (press Ctrl+C again to force exit)")
|
print("\n⚡ Interrupting agent... (press Ctrl+C again to force exit)")
|
||||||
self.agent.interrupt()
|
self.agent.interrupt()
|
||||||
|
else:
|
||||||
|
# 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:
|
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