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: