From 7eef803084d58b9a67736a5e67efd63ea825bd94 Mon Sep 17 00:00:00 2001 From: Blake DeMarcy Date: Wed, 12 Apr 2017 07:00:53 -0500 Subject: [PATCH] integrate init_bodies into overthrowing edit --- clients/urwid/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clients/urwid/main.py b/clients/urwid/main.py index 6d70c1a..110f3d0 100644 --- a/clients/urwid/main.py +++ b/clients/urwid/main.py @@ -804,7 +804,7 @@ class App(object): self.set_footer(string) - def overthrow_ext_edit(self): + def overthrow_ext_edit(self, init_body=""): """ Opens the external editor, but instead of integreating it into the app, stops the mainloop and blocks until the editor is killed. Returns the @@ -812,6 +812,8 @@ class App(object): """ self.loop.stop() descriptor, path = tempfile.mkstemp() + with open(path, "w") as _: + _.write(init_body) run("%s %s" % (self.prefs["editor"], path), shell=True) with open(path) as _: body = _.read() @@ -835,7 +837,7 @@ class App(object): "Title", self.compose, extra_text=e.description) if self.prefs["editor"] and not self.prefs["integrate_external_editor"]: - body = self.overthrow_ext_edit() + body = self.overthrow_ext_edit(init_body) if not body: return self.temp_footer_message("EMPTY POST DISCARDED") params = {"body": body}