summaryrefslogtreecommitdiff
path: root/input.h
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-01-08 14:15:01 -0700
committercflip <cflip@cflip.net>2023-01-08 14:15:01 -0700
commit91195d34e1f71246cadc41705004d66ab647087e (patch)
tree0d2f7e929b7b51590d270e2f22fb5a3621204bf2 /input.h
Initial import of existing source code
This is based off of snaptoken's "Build Your Own Text Editor" tutorial at https://viewsourcecode.org/snaptoken/kilo/.
Diffstat (limited to 'input.h')
-rw-r--r--input.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/input.h b/input.h
new file mode 100644
index 0000000..5e63904
--- /dev/null
+++ b/input.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "editor.h"
+
+enum editor_key {
+ BACKSPACE = 127,
+ ARROW_LEFT = 1000,
+ ARROW_RIGHT,
+ ARROW_UP,
+ ARROW_DOWN,
+ DELETE_KEY,
+ HOME_KEY,
+ END_KEY,
+ PAGE_UP,
+ PAGE_DOWN
+};
+
+#define CTRL_KEY(k) ((k) & 0x1f)
+
+int editor_read_key();
+void editor_move_cursor(struct editor_state* editor, int key);
+void editor_process_keypress(struct editor_state* editor);