From c05156006207d34b1a9944c98f9348578a9640f8 Mon Sep 17 00:00:00 2001 From: yannickreiss Date: Thu, 19 Dec 2024 08:39:02 +0100 Subject: [PATCH] Cut array --- lua/macrotool/init.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lua/macrotool/init.lua b/lua/macrotool/init.lua index 670400c..38b2a3b 100644 --- a/lua/macrotool/init.lua +++ b/lua/macrotool/init.lua @@ -16,15 +16,15 @@ end -- @param mapped_key -- @param raw_key -- @short Add mapped_key to keystrokes -local record_keystroke = function(mapped_key) - table.insert(keystrokes, mapped_key) - -- if #keystrokes > 60 then - -- local temp_keystrokes = {} - -- for i = 31, #keystrokes do - -- table.insert(temp_keystrokes, keystrokes[i]) - -- end - -- keystrokes = temp_keystrokes - -- end +local record_keystroke = function(mapped_key, raw_key) + table.insert(keystrokes, raw_key) + if #keystrokes > 60 then + local temp_keystrokes = {} + for i = 31, #keystrokes do + table.insert(temp_keystrokes, keystrokes[i]) + end + keystrokes = temp_keystrokes + end end vim.on_key(record_keystroke)