From 7be1b9e391a21364d1899d36927f632972e9f529 Mon Sep 17 00:00:00 2001 From: savalet Date: Fri, 23 May 2025 17:22:04 +0200 Subject: [PATCH] Add ctrl+h --- src/repl/key_control_edit2.c | 5 +++++ src/repl/key_handler.h | 1 + src/repl/repl.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/repl/key_control_edit2.c b/src/repl/key_control_edit2.c index 8823c54..3f8495d 100644 --- a/src/repl/key_control_edit2.c +++ b/src/repl/key_control_edit2.c @@ -127,3 +127,8 @@ bool handle_key_ctrl_r(readline_helper_t *rh, exec_ctx_t *ec, buff_t *buff) refresh_line(rh); return false; } + +bool handle_key_ctrl_h(readline_helper_t *rh, exec_ctx_t *ec, buff_t *buff) +{ + return handle_backspace(rh, ec, buff); +} diff --git a/src/repl/key_handler.h b/src/repl/key_handler.h index f56b1cc..dc8072e 100644 --- a/src/repl/key_handler.h +++ b/src/repl/key_handler.h @@ -29,6 +29,7 @@ bool handle_key_ctrl_k(readline_helper_t *rh, exec_ctx_t *, buff_t *buff); bool handle_key_ctrl_w(readline_helper_t *rh, exec_ctx_t *, buff_t *buff); bool handle_key_ctrl_y(readline_helper_t *rh, exec_ctx_t *, buff_t *buff); bool handle_key_ctrl_r(readline_helper_t *rh, exec_ctx_t *ec, buff_t *buff); +bool handle_key_ctrl_h(readline_helper_t *rh, exec_ctx_t *ec, buff_t *buff); bool handle_backspace(readline_helper_t *rh, exec_ctx_t *ec, buff_t *buff); bool handle_delete(readline_helper_t *rh, exec_ctx_t *, buff_t *buff); bool handle_key_tab(readline_helper_t *rh, exec_ctx_t *ec, buff_t *buff); diff --git a/src/repl/repl.c b/src/repl/repl.c index 1ad7aa4..3bfc131 100644 --- a/src/repl/repl.c +++ b/src/repl/repl.c @@ -12,7 +12,6 @@ #include "ast.h" #include "common.h" -#include "debug.h" #include "git.h" #include "repl.h" #include "repl/key_handler.h" @@ -31,6 +30,7 @@ const key_handler_t KEY_HANDLERS[] = { {"\031", handle_key_ctrl_y}, // ^Y {"\022", handle_key_ctrl_r}, // ^R {"\013", handle_key_ctrl_k}, // ^K + {"\010", handle_key_ctrl_h}, // ^H {ESC "[A", handle_key_arrow_up}, {ESC "[B", handle_key_arrow_down}, {ESC "[C", handle_key_arrow_right},