summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-08-20 13:31:42 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-08-20 13:32:20 +0100
commite6d68139f063c48a0b1cf29dfbe012e460b31ce8 (patch)
treeaedd76b8c4d6b8cf3cd0f5181cf3f56145a27a32 /alot
parentfecec5904c3fabf7c1fc7dc4bc233f23cb498d89 (diff)
fix: handle canceling in compose prompts
issue #29
Diffstat (limited to 'alot')
-rw-r--r--alot/command.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/alot/command.py b/alot/command.py
index 2b296d28..7ccf49c4 100644
--- a/alot/command.py
+++ b/alot/command.py
@@ -366,7 +366,7 @@ class ComposeCommand(Command):
cmpl = AccountCompleter(ui.accountman)
fromaddress = ui.prompt(prefix='From>', completer=cmpl, tab=1)
validaddresses = [a.address for a in accounts] + [None]
- while fromaddress not in validaddresses:
+ while fromaddress not in validaddresses: # TODO: not cool
ui.notify('no account for this address. (<esc> cancels)')
fromaddress = ui.prompt(prefix='From>', completer=cmpl)
if not fromaddress:
@@ -378,10 +378,16 @@ class ComposeCommand(Command):
#get To header
if 'To' not in self.mail:
to = ui.prompt(prefix='To>', completer=ContactsCompleter())
+ if to == None:
+ ui.notify('canceled')
+ return
self.mail['To'] = encode_header('to', to)
if settings.config.getboolean('general', 'ask_subject') and \
not 'Subject' in self.mail:
subject = ui.prompt(prefix='Subject>')
+ if subject == None:
+ ui.notify('canceled')
+ return
self.mail['Subject'] = encode_header('subject', subject)
ui.apply_command(EnvelopeEditCommand(mail=self.mail))