the args for KeyAction are not just strings
This commit is contained in:
parent
f976851442
commit
43ece23b89
@ -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):
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user