From 3bbe0fcd6920ce93d1d9a3b2a1e9c18aa14fb387 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Sun, 8 Sep 2024 16:38:14 -0700 Subject: [PATCH] Ctrl+U: Only delete from start of line to cursor Closes #71 --- src/editline.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/editline.c b/src/editline.c index 5ec9afb..cdd1600 100644 --- a/src/editline.c +++ b/src/editline.c @@ -1025,6 +1025,15 @@ static el_status_t bk_word(void) return CSstay; } +static el_status_t bk_kill_line(void) +{ + beg_line(); + if (old_point != rl_point) + return delete_string(old_point - rl_point); + + return CSstay; +} + static el_status_t meta(void) { int c; @@ -1156,14 +1165,7 @@ static el_status_t tty_special(int c) return bk_del_char(); if (c == rl_kill) { - if (rl_point != 0) { - old_point = rl_point; - rl_point = 0; - reposition(c); - } - Repeat = NO_ARG; - - return kill_line(); + return bk_kill_line(); } #ifdef CONFIG_EOF