From 909bccb8076ee45b643e31fcce77aaf14ab66f37 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 31 Dec 2024 12:13:17 +0530 Subject: [PATCH] When mapping a custom kitten allow using shell escaping for the kitten path Fixes #8178 --- docs/changelog.rst | 4 ++++ kitty/options/utils.py | 8 +++----- kitty_tests/options.py | 3 +++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index c3d9d07cf..f4a6630b3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -84,6 +84,10 @@ consumption to do the same tasks. Detailed list of changes ------------------------------------- +0.38.2 [future] + +- When mapping a custom kitten allow using shell escaping for the kitten path (:iss:`8178`) + 0.38.1 [2024-12-26] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/options/utils.py b/kitty/options/utils.py index 85d842665..6bd70ca2a 100644 --- a/kitty/options/utils.py +++ b/kitty/options/utils.py @@ -122,12 +122,10 @@ def send_key(func: str, rest: str) -> FuncArgsType: @func_with_args('run_kitten', 'run_simple_kitten', 'kitten') def kitten_parse(func: str, rest: str) -> FuncArgsType: + parts = to_cmdline(rest) if func == 'kitten': - args = rest.split(maxsplit=1) - else: - args = rest.split(maxsplit=2)[1:] - func = 'kitten' - return func, [args[0]] + (to_cmdline(args[1]) if len(args) > 1 else []) + return func, parts + return 'kitten', args[1:] @func_with_args('open_url') diff --git a/kitty_tests/options.py b/kitty_tests/options.py index 2193515a0..58df6884a 100644 --- a/kitty_tests/options.py +++ b/kitty_tests/options.py @@ -114,6 +114,9 @@ class TestConfParsing(BaseTest): self.ae((ac().func, ac(1).func), ('new_window', 'launch')) self.ae(ac(1).args, ('--moo', 'XXX')) + opts = p('clear_all_shortcuts y', 'action_alias ss kitten "space 1"', 'map f1 ss "space 2"') + self.ae(ac().args, ('space 1', 'space 2')) + opts = p('kitty_mod alt') self.ae(opts.kitty_mod, to_modifiers('alt')) self.ae(next(keys_for_func(opts, 'next_layout')).mods, opts.kitty_mod)