summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-07-29 15:56:32 -0400
committerpommicket <pommicket@gmail.com>2022-07-29 15:56:32 -0400
commitd9edd1f62fa620d3a8a42c80aec330065b794e14 (patch)
tree1f19aeabca40196b7987537a7b09f1af30c71c3d /menu.c
parentefce2c731927adc4aaf26d6cc6c165bbced39eb5 (diff)
fixed double ctrl+q problem
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/menu.c b/menu.c
index ae69eac..5a0e964 100644
--- a/menu.c
+++ b/menu.c
@@ -1,4 +1,4 @@
-static void menu_close(Ted *ted) {
+static void menu_close_with_next(Ted *ted, Menu next) {
ted_switch_to_buffer(ted, ted->prev_active_buffer);
TextBuffer *buffer = ted->active_buffer;
ted->prev_active_buffer = NULL;
@@ -14,8 +14,10 @@ static void menu_close(Ted *ted) {
buffer_clear(&ted->line_buffer);
break;
case MENU_WARN_UNSAVED:
- ted->warn_unsaved = 0;
- *ted->warn_unsaved_names = 0;
+ if (next != MENU_WARN_UNSAVED) {
+ ted->warn_unsaved = 0;
+ *ted->warn_unsaved_names = 0;
+ }
break;
case MENU_ASK_RELOAD:
*ted->ask_reload = 0;
@@ -40,9 +42,13 @@ static void menu_close(Ted *ted) {
ted->selector_open = NULL;
}
-static void menu_open(Ted *ted, Menu menu) {
+void menu_close(Ted *ted) {
+ menu_close_with_next(ted, 0);
+}
+
+void menu_open(Ted *ted, Menu menu) {
if (ted->menu)
- menu_close(ted);
+ menu_close_with_next(ted, menu);
if (ted->find) find_close(ted);
ted->autocomplete = false;
ted->menu = menu;