From 9434a34116ed1f7d581906d00aed49d1b1219f24 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Mon, 24 Nov 2025 20:49:55 -0800 Subject: [PATCH] kill_region appears to work --- main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 43db16f..4c395dc 100644 --- a/main.c +++ b/main.c @@ -11,8 +11,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -727,6 +729,7 @@ kill_region(void) move_cursor(ARROW_RIGHT); } killring_append_char('\n'); + move_cursor(ARROW_RIGHT); } while (editor.curx != curx) { @@ -1353,10 +1356,10 @@ get_keypress(void) char * editor_prompt(char *prompt, void (*cb)(char *, int16_t)) { - size_t bufsz = 128; - char *buf = malloc(bufsz); - size_t buflen = 0; - int16_t c; + size_t bufsz = 128; + char *buf = malloc(bufsz); + size_t buflen = 0; + int16_t c; buf[0] = '\0'; @@ -1398,6 +1401,8 @@ editor_prompt(char *prompt, void (*cb)(char *, int16_t)) cb(buf, c); } } + + free(buf); } @@ -1700,6 +1705,7 @@ process_kcommand(int16_t c) break; case 'u': editor_set_status("undo: todo"); + break; case 'y': killring_yank(); break; @@ -1797,6 +1803,7 @@ process_escape(int16_t c) break; } kill_region(); + break; case BACKSPACE: delete_prev_word(); break;