Fix key handling in diff kitten
This commit is contained in:
parent
66341111e6
commit
9c6ba213f9
@ -93,7 +93,7 @@ class DiffHandler(Handler):
|
||||
self.highlighting_done = False
|
||||
self.restore_position: Optional[Reference] = None
|
||||
for key_def, action in self.opts.key_definitions.items():
|
||||
self.add_shortcut(action, *key_def)
|
||||
self.add_shortcut(action, key_def)
|
||||
|
||||
def perform_action(self, action: KittensKeyAction) -> None:
|
||||
func, args = action
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -277,14 +277,13 @@ class Loop:
|
||||
pass
|
||||
else:
|
||||
self.handler.on_mouse(ev)
|
||||
elif q == '~':
|
||||
elif q in 'u~ABCDHFPQRS':
|
||||
if csi == '200~':
|
||||
self.in_bracketed_paste = True
|
||||
return
|
||||
elif csi == '201~':
|
||||
self.in_bracketed_paste = False
|
||||
return
|
||||
elif q in 'u~ABCDHFPQRS':
|
||||
try:
|
||||
k = decode_key_event(csi[:-1], q)
|
||||
except Exception:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user