mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-12 10:47:05 +02:00
Also prevent infinite recursion in kitten_alias
This commit is contained in:
@@ -50,29 +50,41 @@ class TestConfParsing(BaseTest):
|
||||
self.assertFalse(bad_lines)
|
||||
opts = p('pointer_shape_when_grabbed XXX', bad_line_num=1)
|
||||
self.ae(opts.pointer_shape_when_grabbed, defaults.pointer_shape_when_grabbed)
|
||||
|
||||
opts = p('env A=1', 'env B=x$A', 'env C=', 'env D', 'clear_all_shortcuts y', 'kitten_alias a b --moo', 'map f1 kitten a arg')
|
||||
self.ae(opts.env, {'A': '1', 'B': 'x1', 'C': '', 'D': DELETE_ENV_VAR})
|
||||
ka = tuple(opts.keymap.values())[0][0]
|
||||
self.ae(ka.func, 'kitten')
|
||||
self.ae(ka.args, ('b', '--moo', 'arg'))
|
||||
|
||||
opts = p('clear_all_shortcuts y', 'kitten_alias hints hints --hi', 'map f1 kitten hints XXX')
|
||||
ka = tuple(opts.keymap.values())[0][0]
|
||||
self.ae(ka.func, 'kitten')
|
||||
self.ae(ka.args, ('hints', '--hi', 'XXX'))
|
||||
|
||||
opts = p('clear_all_shortcuts y', 'action_alias la launch --moo', 'map f1 la XXX')
|
||||
ka = tuple(opts.keymap.values())[0][0]
|
||||
self.ae(ka.func, 'launch')
|
||||
self.ae(ka.args, ('--moo', 'XXX'))
|
||||
|
||||
opts = p('clear_all_shortcuts y', 'action_alias one launch --moo', 'action_alias two one recursive', 'map f1 two XXX')
|
||||
ka = tuple(opts.keymap.values())[0][0]
|
||||
self.ae(ka.func, 'launch')
|
||||
self.ae(ka.args, ('--moo', 'recursive', 'XXX'))
|
||||
|
||||
opts = p('clear_all_shortcuts y', 'action_alias launch launch --moo', 'map f1 launch XXX')
|
||||
ka = tuple(opts.keymap.values())[0][0]
|
||||
self.ae(ka.func, 'launch')
|
||||
self.ae(ka.args, ('--moo', 'XXX'))
|
||||
|
||||
opts = p('clear_all_shortcuts y', 'action_alias la launch --moo', 'map f1 combine : new_window : la ')
|
||||
ka = tuple(opts.keymap.values())[0]
|
||||
self.ae((ka[0].func, ka[1].func), ('new_window', 'launch'))
|
||||
|
||||
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)
|
||||
|
||||
# deprecation handling
|
||||
opts = p('clear_all_shortcuts y', 'send_text all f1 hello')
|
||||
self.ae(len(opts.keymap), 1)
|
||||
|
||||
Reference in New Issue
Block a user