From 60c5f9aad1d9442a829ac5651fc80e5f6363596f Mon Sep 17 00:00:00 2001 From: Blake DeMarcy Date: Thu, 20 Apr 2017 06:04:44 -0500 Subject: [PATCH] properly handle C-z in editor mode --- clients/urwid/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/clients/urwid/main.py b/clients/urwid/main.py index a6b4da0..afb1c90 100644 --- a/clients/urwid/main.py +++ b/clients/urwid/main.py @@ -1521,7 +1521,7 @@ class ExternalEditor(urwid.Terminal): def keypress(self, size, key): 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 # 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. @@ -1534,10 +1534,11 @@ class ExternalEditor(urwid.Terminal): return os.write(self.master, key) elif key.lower() == "ctrl l": - # always do this, and also pass it to the terminal 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) elif key == "f1": @@ -1551,6 +1552,9 @@ class ExternalEditor(urwid.Terminal): elif key == "f3": app.formatting_help() + elif keyl == "ctrl z": + os.killpg(os.getpgid(os.getpid()), 19) + def __del__(self): """