rework keyboard event lookup failure handling with suggestions from Thomas. Relates to LP #280959
This commit is contained in:
parent
46774d8f9e
commit
19619bff98
|
@ -81,9 +81,11 @@ class TerminatorKeybindings:
|
|||
raise KeymapError("Unhandled modifier '<%s>'" % modifier)
|
||||
|
||||
def lookup(self, event):
|
||||
if not event:
|
||||
raise KeymapError("lookup called with no event")
|
||||
try:
|
||||
keyval, egroup, level, consumed = self.keymap.translate_keyboard_state(event.hardware_keycode, event.state, event.group)
|
||||
except TypeError:
|
||||
err ("keybindings.lookup failed to translate keyboard event: %s"%dir(event))
|
||||
return None
|
||||
mask = (event.state & ~consumed) & self._masks
|
||||
return self._lookup.get(mask, self.empty).get(event.keyval, None)
|
||||
|
||||
|
|
Loading…
Reference in New Issue