mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 17:52:02 +02:00
Parse actions on demand
This removes the startup cost of parsing hundreds of default actions when action_alias or kitten_alias are used. Although the cost is on the order of 1ms, this design feels cleaner and gives nicer debug config output.
This commit is contained in:
@@ -69,11 +69,11 @@ class Callbacks:
|
||||
|
||||
def on_mouse_event(self, event):
|
||||
ev = MouseEvent(**event)
|
||||
actions = self.opts.mousemap.get(ev)
|
||||
if not actions:
|
||||
action_def = self.opts.mousemap.get(ev)
|
||||
if not action_def:
|
||||
return False
|
||||
self.current_mouse_button = ev.button
|
||||
for action in actions:
|
||||
for action in self.opts.alias_map.resolve_aliases(action_def, 'mouse_map'):
|
||||
getattr(self, action.func)(*action.args)
|
||||
self.current_mouse_button = 0
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user