fix: Ctrl+D deletes char under cursor, only exits on empty input (bash/zsh behaviour)

This commit is contained in:
CK iRonin.IT 2026-04-03 10:55:19 -04:00 committed by Teknium
parent 1dcf79a864
commit 08d5c9c539

12
cli.py
View file

@ -9557,9 +9557,15 @@ class HermesCLI:
@kb.add('c-d') @kb.add('c-d')
def handle_ctrl_d(event): def handle_ctrl_d(event):
"""Handle Ctrl+D - exit.""" """Ctrl+D: delete char under cursor (standard readline behaviour).
self._should_exit = True Only exit when the input is empty same as bash/zsh.
event.app.exit() """
buf = event.app.current_buffer
if buf.text:
buf.delete()
else:
self._should_exit = True
event.app.exit()
_modal_prompt_active = Condition( _modal_prompt_active = Condition(
lambda: bool(self._secret_state or self._sudo_state) lambda: bool(self._secret_state or self._sudo_state)