summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-01-09 15:47:26 -0700
committercflip <cflip@cflip.net>2023-01-09 15:47:26 -0700
commitc1573dbbb3e70cad8c1f94cbed5b2abf2b124ace (patch)
tree8333d29b92f12f7cbf97deb38e25875887d6b19a /input.c
parent54d8fdd290e21ae8c773b4228827ee7539637ce8 (diff)
Implement basic keyboard event handling
Diffstat (limited to 'input.c')
-rw-r--r--input.c5
1 files changed, 1 insertions, 4 deletions
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'):