From c1573dbbb3e70cad8c1f94cbed5b2abf2b124ace Mon Sep 17 00:00:00 2001 From: cflip Date: Mon, 9 Jan 2023 15:47:26 -0700 Subject: Implement basic keyboard event handling --- input.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 17a37f6..fac8aba 100644 --- a/input.c +++ b/input.c @@ -97,10 +97,9 @@ void editor_move_cursor(struct editor_state* editor, int key) editor->cursor_x = row_length; } -void editor_process_keypress(struct editor_state* editor) +void editor_process_keypress(struct editor_state* editor, int c) { static int quit_message = 1; - int c = editor_read_key(); switch (c) { case '\r': @@ -112,8 +111,6 @@ void editor_process_keypress(struct editor_state* editor) quit_message = 0; return; } - write(STDOUT_FILENO, "\x1b[2J", 4); - write(STDOUT_FILENO, "\x1b[H", 3); exit(0); break; case CTRL_KEY('s'): -- cgit v1.2.3