From 24addd792a50ff47a904f819375bed32b32039a0 Mon Sep 17 00:00:00 2001 From: cflip Date: Mon, 30 Jan 2023 14:31:28 -0700 Subject: Move unsaved quit warning to editor.c --- input.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index da1d6e5..73889bd 100644 --- a/input.c +++ b/input.c @@ -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; } -- cgit v1.2.3