summaryrefslogtreecommitdiff
path: root/editor.h
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 /editor.h
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 'editor.h')
-rw-r--r--editor.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/editor.h b/editor.h
index f38a7d4..0fe8bab 100644
--- a/editor.h
+++ b/editor.h
@@ -25,6 +25,12 @@ struct editor_state {
time_t status_message_time;
struct editor_syntax* syntax;
int mode;
+ /*
+ * Keep track of whether a key that toggles insert mode has been pressed, so
+ * we can ignore it during the text input event. Otherwise, an 'i' or other
+ * letter will be inserted when entering insert mode.
+ */
+ int pressed_insert_key;
};
void init_editor(struct editor_state* editor);