summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-30 13:36:03 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-30 13:36:03 -0500
commit2994bf93de60930af3855db7a230c27be77de4ef (patch)
treecdcfe86c1fbb0cab8752e53dc47b3154266b407f /menu.c
parentb35a780479bbf5038a825d415f9ca49c92f6b425 (diff)
middle click to close tab
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/menu.c b/menu.c
index 5cdf83f..8fd0a3b 100644
--- a/menu.c
+++ b/menu.c
@@ -128,12 +128,14 @@ static void menu_update(Ted *ted, Menu menu) {
case POPUP_YES:
// save changes
switch (ted->warn_unsaved) {
- case CMD_TAB_CLOSE:
+ case CMD_TAB_CLOSE: {
menu_close(ted, true);
- if (buffer_save(ted->prev_active_buffer)) {
+ TextBuffer *buffer = ted->active_buffer;
+ command_execute(ted, CMD_SAVE, 1);
+ if (!buffer_unsaved_changes(buffer)) {
command_execute(ted, CMD_TAB_CLOSE, 1);
}
- break;
+ } break;
case CMD_QUIT:
menu_close(ted, true);
if (ted_save_all(ted)) {