From d800631a07a3c386a76e76ce3d5f6cea2320eca2 Mon Sep 17 00:00:00 2001 From: savalet Date: Fri, 23 May 2025 17:20:10 +0200 Subject: [PATCH] Ctrl+d can now delete the current char --- src/repl/key_control.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/repl/key_control.c b/src/repl/key_control.c index f26df52..cad4bba 100644 --- a/src/repl/key_control.c +++ b/src/repl/key_control.c @@ -23,12 +23,14 @@ bool handle_key_ctrl_c(readline_helper_t *rh, exec_ctx_t *ec, buff_t *buff) bool handle_key_ctrl_d(readline_helper_t *rh, exec_ctx_t *ec, buff_t *buff) { - if (rh->cursor) { + if (rh->cursor && rh->cursor == buff->sz) { WRITE_CONST(STDOUT_FILENO, "\n"); print_shell_prompt(ec); refresh_line(rh); return false; } + if (buff->sz) + return handle_delete(rh, ec, buff); if (ec->ignoreof) return false; buff->sz = 0;