summaryrefslogtreecommitdiff
path: root/alot/commands
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2016-03-12 14:17:36 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2016-03-12 14:19:12 +0000
commit621c2288e1c2f4c04ccd7888801031f15165b8f8 (patch)
tree0d3fc28e266f9c36205bca4b5fd9c2b83d9e49ac /alot/commands
parentbda3aa99c797d609c185642fb767272e9bf884c1 (diff)
Make sure to flush on exit
Diffstat (limited to 'alot/commands')
-rw-r--r--alot/commands/globals.py15
1 files changed, 11 insertions, 4 deletions
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=[