summaryrefslogtreecommitdiff
path: root/alot/commands/envelope.py
diff options
context:
space:
mode:
Diffstat (limited to 'alot/commands/envelope.py')
-rw-r--r--alot/commands/envelope.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index ce599781..25d7cc94 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -239,7 +239,14 @@ class EditCommand(Command):
value = re.sub('[ \t\r\f\v]*\n[ \t\r\f\v]*', ' ', value)
headertext += '%s: %s\n' % (key, value)
+ # determine editable content
bodytext = self.envelope.body
+ if headertext:
+ content = '%s\n%s' % (headertext, bodytext)
+ self.edit_only_body = False
+ else:
+ content = bodytext
+ self.edit_only_body = True
# call pre-edit translate hook
translate = settings.get_hook('pre_edit_translate')
@@ -248,11 +255,6 @@ class EditCommand(Command):
#write stuff to tempfile
tf = tempfile.NamedTemporaryFile(delete=False, prefix='alot.')
- content = bodytext
- if headertext:
- content = '%s\n%s' % (headertext, content)
- else:
- self.edit_only_body = True
tf.write(content.encode('utf-8'))
tf.flush()
tf.close()