From 621c2288e1c2f4c04ccd7888801031f15165b8f8 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Sat, 12 Mar 2016 14:17:36 +0000 Subject: Make sure to flush on exit --- alot/commands/globals.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'alot/commands') diff --git a/alot/commands/globals.py b/alot/commands/globals.py index b0ca6b7b..5704b153 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -41,15 +41,22 @@ class ExitCommand(Command): """shut down cleanly""" @inlineCallbacks def apply(self, ui): - msg = 'index not fully synced. ' if ui.db_was_locked else '' - if settings.get('bug_on_exit') or ui.db_was_locked: - msg += 'really quit?' + if settings.get('bug_on_exit'): + msg = 'really quit?' if (yield ui.choice(msg, select='yes', cancel='no', msg_position='left')) == 'no': return + for b in ui.buffers: b.cleanup() - ui.exit() + ui.apply_command(FlushCommand(callback=ui.exit)) + + if ui.db_was_locked: + msg = 'Database locked. Exit without saving?' + if (yield ui.choice(msg, select='yes', cancel='no', + msg_position='left')) == 'no': + return + ui.exit() @registerCommand(MODE, 'search', usage='search query', arguments=[ -- cgit v1.2.3