properly handle C-z in editor mode

pull/4/head
Blake DeMarcy 2017-04-20 06:04:44 -05:00
parent fa9cc49337
commit 60c5f9aad1
1 changed files with 7 additions and 3 deletions

View File

@ -1521,7 +1521,7 @@ class ExternalEditor(urwid.Terminal):
def keypress(self, size, key): def keypress(self, size, key):
if key in ["down", "up", "left", "right"]: if key in ["down", "up", "left", "right"]:
# HACK HACK HACK HACK: something somewhere is capturing some keys within # HACK: something somewhere is capturing some keys within
# the parent keypress method until some other keys are pressed. So when # the parent keypress method until some other keys are pressed. So when
# this widget was spawned, it would ignore arrow keys, C-n/C-p, pager keys, # this widget was spawned, it would ignore arrow keys, C-n/C-p, pager keys,
# but when some _OTHER_ keys were pressed, this lock was released. Weird shit. # but when some _OTHER_ keys were pressed, this lock was released. Weird shit.
@ -1534,10 +1534,11 @@ class ExternalEditor(urwid.Terminal):
return os.write(self.master, key) return os.write(self.master, key)
elif key.lower() == "ctrl l": elif key.lower() == "ctrl l":
# always do this, and also pass it to the terminal
wipe_screen() wipe_screen()
# always do this, and also pass it to the terminal
elif key not in ["f1", "f2", "f3"]: keyl = key.lower()
if keyl not in ["f1", "f2", "f3", "ctrl z"]:
return super(ExternalEditor, self).keypress(size, key) return super(ExternalEditor, self).keypress(size, key)
elif key == "f1": elif key == "f1":
@ -1551,6 +1552,9 @@ class ExternalEditor(urwid.Terminal):
elif key == "f3": elif key == "f3":
app.formatting_help() app.formatting_help()
elif keyl == "ctrl z":
os.killpg(os.getpgid(os.getpid()), 19)
def __del__(self): def __del__(self):
""" """