Fix key handling in diff kitten

This commit is contained in:
Kovid Goyal
2021-01-15 09:48:11 +05:30
parent 66341111e6
commit 9c6ba213f9
3 changed files with 4 additions and 4 deletions

View File

@@ -36,7 +36,6 @@ class Handler:
self.debug = debug
self.cmd = commander(self)
self._image_manager = image_manager
self._key_shortcuts: Dict[ParsedShortcut, KittensKeyActionType] = {}
@property
def image_manager(self) -> ImageManagerType:
@@ -48,6 +47,8 @@ class Handler:
return self._tui_loop.asycio_loop
def add_shortcut(self, action: KittensKeyActionType, spec: Union[str, ParsedShortcut]) -> None:
if not hasattr(self, '_key_shortcuts'):
self._key_shortcuts: Dict[ParsedShortcut, KittensKeyActionType] = {}
if isinstance(spec, str):
from kitty.key_encoding import parse_shortcut
spec = parse_shortcut(spec)