summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-12-21 13:02:30 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-12-21 13:02:30 -0500
commit41c33e59e85909989009e96370403abf319008ad (patch)
tree2f52edfef50e792315e8277acbf7e0e6fec340b5 /main.c
parentb50f5c763c575d7284b7a7e7507b2151d1e98fbf (diff)
more undo
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/main.c b/main.c
index 93bac8a..31dd849 100644
--- a/main.c
+++ b/main.c
@@ -78,6 +78,7 @@ int main(void) {
SDL_Event event;
Uint8 const *keyboard_state = SDL_GetKeyboardState(NULL);
bool ctrl = keyboard_state[SDL_SCANCODE_LCTRL] || keyboard_state[SDL_SCANCODE_RCTRL];
+ bool shift = keyboard_state[SDL_SCANCODE_LSHIFT] || keyboard_state[SDL_SCANCODE_RSHIFT];
while (SDL_PollEvent(&event)) {
// @TODO: make a function to handle text buffer events
@@ -142,6 +143,15 @@ int main(void) {
}
}
break;
+ case SDLK_z:
+ if (ctrl) {
+ if (shift) {
+ buffer_undo(&text_buffer, 1);
+ } else {
+ buffer_redo(&text_buffer, 1);
+ }
+ }
+ break;
}
} break;
case SDL_TEXTINPUT: {