From 46774d8f9ee1c5002aae4e0be42f0828e959502c Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sun, 12 Oct 2008 23:42:30 +0100 Subject: [PATCH] Abandon attempts to handle empty keypress events. Relates to LP #280959 --- terminatorlib/keybindings.py | 2 ++ terminatorlib/terminatorterm.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/terminatorlib/keybindings.py b/terminatorlib/keybindings.py index ea7c0e6b..dfdeb36b 100644 --- a/terminatorlib/keybindings.py +++ b/terminatorlib/keybindings.py @@ -81,6 +81,8 @@ class TerminatorKeybindings: raise KeymapError("Unhandled modifier '<%s>'" % modifier) def lookup(self, event): + if not event: + raise KeymapError("lookup called with no event") keyval, egroup, level, consumed = self.keymap.translate_keyboard_state(event.hardware_keycode, event.state, event.group) mask = (event.state & ~consumed) & self._masks return self._lookup.get(mask, self.empty).get(event.keyval, None) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index a568a34e..6b542a56 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -676,6 +676,9 @@ text/plain #the selected terminal) UnhandledKeybindings = ('close_window', 'full_screen') def on_vte_key_press (self, term, event): + if not event: + dbg ('on_vte_key_press: Called on %s with no event'%term) + return False mapping = self.terminator.keybindings.lookup(event) if mapping and mapping not in self.UnhandledKeybindings: