diff options
author | cflip <cflip@cflip.net> | 2023-01-12 12:19:08 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2023-01-12 12:21:03 -0700 |
commit | 4c150aab138f5733d29ad4548d66764fe19ffc44 (patch) | |
tree | 6559f4cfafb7abb9a10b4a12be0ec79ee5b93df7 /input.h | |
parent | ab00e1e288743496e75c5e54c0e6abdecf439642 (diff) |
Make the editor modal and refactor keyboard events
This makes the editor behave more like vi, with a seperate insert mode.
This also refactors the keyboard input code to pass the SDL_Keysym
structure to input.c and to use the SDL_TEXTINPUT event for editing
text.
SDL's text input event already fixes typing capital letters with shift,
and should make it possible to enter text using an IME, however most
unicode characters aren't properly rendered.
Diffstat (limited to 'input.h')
-rw-r--r-- | input.h | 18 |
1 files changed, 2 insertions, 16 deletions
@@ -2,22 +2,8 @@ #define _INPUT_H #include "editor.h" +#include <SDL2/SDL_keyboard.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) - -void editor_process_keypress(struct editor_state *editor, int keycode); +void editor_process_keypress(struct editor_state *editor, SDL_Keysym *keysym); #endif |