From 76f2595df76f81bdbca360fe032167b6b1269a4d Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 8 Feb 2012 18:25:00 +1300 Subject: KVEditor: "e" shortcut spawns an external editor on a field. --- libmproxy/console/connview.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'libmproxy/console/connview.py') diff --git a/libmproxy/console/connview.py b/libmproxy/console/connview.py index ac25ea9a..0b354479 100644 --- a/libmproxy/console/connview.py +++ b/libmproxy/console/connview.py @@ -275,28 +275,6 @@ class ConnectionView(common.WWrap): else: self.view_request() - def _spawn_editor(self, data): - fd, name = tempfile.mkstemp('', "mproxy") - os.write(fd, data) - os.close(fd) - c = os.environ.get("EDITOR") - #If no EDITOR is set, assume 'vi' - if not c: - c = "vi" - cmd = [c, name] - self.master.ui.stop() - try: - subprocess.call(cmd) - except: - self.master.statusbar.message("Can't start editor: %s" % c) - self.master.ui.start() - os.unlink(name) - return data - self.master.ui.start() - data = open(name).read() - os.unlink(name) - return data - def edit_method(self, m): for i in self.methods: if i[1] == m: @@ -354,7 +332,7 @@ class ConnectionView(common.WWrap): self.flow.backup() if part == "b": - c = self._spawn_editor(conn.content or "") + c = self.master.spawn_editor(conn.content or "") conn.content = c.rstrip("\n") elif part == "h": self.master.view_kveditor("Editing headers", conn.headers.lst, self.set_headers, conn) -- cgit v1.2.3