Use .stop() and .start() to restart curses around external spawns.

This commit is contained in:
Aldo Cortesi 2011-03-14 16:09:06 +13:00
parent 974cb03631
commit bb8adfb731

View File

@ -371,18 +371,15 @@ class ConnectionView(WWrap):
if not c: if not c:
c = "vi" c = "vi"
cmd = [c, name] cmd = [c, name]
self.master.ui.stop()
try: try:
ret = subprocess.call(cmd) ret = subprocess.call(cmd)
except: except:
self.master.statusbar.message("Can't start editor: %s" % c) self.master.statusbar.message("Can't start editor: %s" % c)
self.master.ui._curs_set(1) self.master.ui.start()
self.master.ui.clear()
os.unlink(name) os.unlink(name)
return data return data
# Not sure why, unless we do this we get a visible cursor after self.master.ui.start()
# spawning 'less'.
self.master.ui._curs_set(1)
self.master.ui.clear()
data = open(name).read() data = open(name).read()
os.unlink(name) os.unlink(name)
return data return data
@ -947,11 +944,9 @@ class ConsoleMaster(flow.FlowMaster):
if not cmd: if not cmd:
c = os.environ.get("PAGER") or os.environ.get("EDITOR") c = os.environ.get("PAGER") or os.environ.get("EDITOR")
cmd = [c, name] cmd = [c, name]
self.ui.stop()
ret = subprocess.call(cmd, shell=shell) ret = subprocess.call(cmd, shell=shell)
# Not sure why, unless we do this we get a visible cursor after self.ui.start()
# spawning 'less'.
self.ui._curs_set(1)
self.ui.clear()
os.unlink(name) os.unlink(name)
def set_palette(self): def set_palette(self):