summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-01-16 13:36:25 -0700
committercflip <cflip@cflip.net>2023-01-16 13:36:25 -0700
commit58d38d02b215f2e4829ccdc399df8d59bb6cb140 (patch)
treee59bd669d2381ce320dc952752d31e0606347b5a /input.c
parent617db1d87703e929390a3ea04d189a25c4aaa026 (diff)
Ignore first keypress after entering insert mode
This fixes the problem where the key used to enter insert mode ('i' for example) would also be typed into the document.
Diffstat (limited to 'input.c')
-rw-r--r--input.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/input.c b/input.c
index 37f4c2e..74222bb 100644
--- a/input.c
+++ b/input.c
@@ -61,6 +61,7 @@ void editor_process_keypress(struct editor_state *editor, SDL_Keysym *keysym)
break;
case SDLK_i:
editor->mode = EDITOR_MODE_INSERT;
+ editor->pressed_insert_key = 1;
break;
case SDLK_a:
if (keysym->mod & KMOD_SHIFT)
@@ -68,6 +69,7 @@ void editor_process_keypress(struct editor_state *editor, SDL_Keysym *keysym)
else
editor_move_right(editor);
editor->mode = EDITOR_MODE_INSERT;
+ editor->pressed_insert_key = 1;
break;
case SDLK_o:
if (keysym->mod & KMOD_SHIFT)
@@ -75,6 +77,7 @@ void editor_process_keypress(struct editor_state *editor, SDL_Keysym *keysym)
else
editor_add_line_below(editor);
editor->mode = EDITOR_MODE_INSERT;
+ editor->pressed_insert_key = 1;
break;
case SDLK_k:
editor_move_up(editor);