diff --git a/src/repl/key_control_edit.c b/src/repl/key_control_edit.c index c6573a6..b1145bd 100644 --- a/src/repl/key_control_edit.c +++ b/src/repl/key_control_edit.c @@ -35,7 +35,9 @@ bool handle_key_ctrl_f(readline_helper_t *rh, exec_ctx_t *ec, buff_t *buff) bool handle_key_ctrl_k(readline_helper_t *rh, exec_ctx_t *, buff_t *buff) { + if (!buff->sz && !rh->cursor) + return false; buff->sz = rh->cursor; refresh_line(rh); - return true; + return false; } diff --git a/src/repl/repl.c b/src/repl/repl.c index 8440d8a..b06bbdf 100644 --- a/src/repl/repl.c +++ b/src/repl/repl.c @@ -30,6 +30,7 @@ const key_handler_t KEY_HANDLERS[] = { {"\027", handle_key_ctrl_w}, // ^W {"\031", handle_key_ctrl_y}, // ^Y {"\022", handle_key_ctrl_r}, // ^R + {"\013", handle_key_ctrl_k}, // ^K {ESC "[A", handle_key_arrow_up}, {ESC "[B", handle_key_arrow_down}, {ESC "[C", handle_key_arrow_right},