From 3c78fe22859bbce0efc402a5f793cb7a4639817a Mon Sep 17 00:00:00 2001 From: zhsfei Date: Tue, 24 Sep 2024 14:23:42 +0800 Subject: [PATCH] Update init.lua Repeated binding, resulting in slowdown --- Source/RecursiveBinder.spoon/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/RecursiveBinder.spoon/init.lua b/Source/RecursiveBinder.spoon/init.lua index 6fb2291e..53f15e85 100644 --- a/Source/RecursiveBinder.spoon/init.lua +++ b/Source/RecursiveBinder.spoon/init.lua @@ -257,11 +257,15 @@ function obj.recursiveBind(keymap) local func = obj.recursiveBind(map) -- key[1] is modifiers, i.e. {'shift'}, key[2] is key, i.e. 'f' modal:bind(key[1], key[2], function() modal:exit() killHelper() func() end) - modal:bind(obj.escapeKey[1], obj.escapeKey[2], function() modal:exit() killHelper() end) + + -- Repeated binding, resulting in slowdown + -- modal:bind(obj.escapeKey[1], obj.escapeKey[2], function() modal:exit() killHelper() end) if #key >= 3 then keyFuncNameTable[createKeyName(key)] = key[3] end end + -- fix repeat bind + modal:bind(obj.escapeKey[1], obj.escapeKey[2], function() modal:exit() killHelper() end) return function() modal:enter() killHelper()