From 43ece23b8992cd8424879f567d935b1fa7aad582 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 28 May 2021 12:05:24 +0530 Subject: [PATCH] the args for KeyAction are not just strings --- kitty/options/utils.py | 8 ++++---- kitty/window.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kitty/options/utils.py b/kitty/options/utils.py index 3ed75fe53..c94afca84 100644 --- a/kitty/options/utils.py +++ b/kitty/options/utils.py @@ -48,7 +48,7 @@ FuncArgsType = Tuple[str, Sequence[Any]] class KeyAction(NamedTuple): func: str - args: Sequence[str] = () + args: Tuple[Union[str, float, bool, int, None], ...] = () def __repr__(self) -> str: if self.args: @@ -753,7 +753,7 @@ def parse_key_action(action: str, action_type: str = 'map') -> Optional[KeyActio except Exception as err: log_error(f'Ignoring invalid {action_type} action: {action} with err: {err}') else: - return KeyAction(func, args) + return KeyAction(func, tuple(args)) else: log_error(f'Ignoring unknown {action_type} action: {action}') return None @@ -766,7 +766,7 @@ class BaseDefinition: if not self.action.args: return kitten = self.action.args[0] - rest = self.action.args[1] if len(self.action.args) > 1 else '' + rest = str(self.action.args[1] if len(self.action.args) > 1 else '') changed = False for key, expanded in aliases.items(): if key == kitten: @@ -775,7 +775,7 @@ class BaseDefinition: if len(expanded) > 1: rest = expanded[1] + ' ' + rest if changed: - self.action = self.action._replace(args=[kitten, rest.rstrip()]) + self.action = self.action._replace(args=(kitten, rest.rstrip())) class MouseMapping(BaseDefinition): diff --git a/kitty/window.py b/kitty/window.py index d0e434407..83ed16908 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -1016,7 +1016,7 @@ class Window: self.current_marker_spec = key def set_marker(self, spec: Union[str, Sequence[str]]) -> None: - from .config import parse_marker_spec, toggle_marker + from .options.utils import parse_marker_spec, toggle_marker from .marks import marker_from_spec if isinstance(spec, str): func, (ftype, spec_, flags) = toggle_marker('toggle_marker', spec)