diff options
author | cflip <cflip@cflip.net> | 2023-01-30 14:31:28 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2023-01-30 14:31:28 -0700 |
commit | 24addd792a50ff47a904f819375bed32b32039a0 (patch) | |
tree | 144418ddc0dd45847ae76d69937b4d136203b848 /input.c | |
parent | d2a225cd108507714d505d3c133fec6660e45c8d (diff) |
Move unsaved quit warning to editor.c
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -6,8 +6,6 @@ void editor_process_keypress(struct editor_state *editor, SDL_Keysym *keysym) { - static int quit_message = 1; - /* Handle keypresses for typing modes separately. */ if (editor->mode != EDITOR_MODE_NORMAL) { if (keysym->sym == SDLK_BACKSPACE) @@ -44,12 +42,8 @@ void editor_process_keypress(struct editor_state *editor, SDL_Keysym *keysym) break; case SDLK_q: if (keysym->mod & KMOD_CTRL) { - if (editor->dirty && quit_message) { - editor_set_status_message(editor, "This file has unsaved changes. Press Ctrl+Q again to quit"); - quit_message = 0; - return; - } - exit(0); + editor_try_quit(editor); + break; } editor->cursor_x = 0; break; @@ -87,6 +81,4 @@ void editor_process_keypress(struct editor_state *editor, SDL_Keysym *keysym) editor_find(editor); break; } - - quit_message = 1; } |