From 8ed5d54a98f2f055478c769539a5a2e2726cdf22 Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 6 Aug 2023 17:14:12 -0400 Subject: [PATCH] fix: handle CR keypresses --- doc/keyseer.txt | 1 + lua/keyseer/init.lua | 1 + lua/keyseer/keyboard/dvorak.lua | 2 +- lua/keyseer/keyboard/qwerty.lua | 2 +- lua/keyseer/keymaps/keypress.lua | 1 + lua/keyseer/utils.lua | 1 + tests/test_keymaps.lua | 1 + tests/test_utils.lua | 1 + 8 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/keyseer.txt b/doc/keyseer.txt index 4e27df8..1bff7e9 100644 --- a/doc/keyseer.txt +++ b/doc/keyseer.txt @@ -65,6 +65,7 @@ Default values: highlight_padding = { 0, 0, 0, 0 }, -- override the label used to display some keys. key_labels = { + [""] = "", ["Up"] = "↑", ["Down"] = "↓", ["Left"] = "←", diff --git a/lua/keyseer/init.lua b/lua/keyseer/init.lua index a9a8a80..217aef0 100644 --- a/lua/keyseer/init.lua +++ b/lua/keyseer/init.lua @@ -97,6 +97,7 @@ KeySeer.config = { highlight_padding = { 0, 0, 0, 0 }, -- override the label used to display some keys. key_labels = { + [""] = "", ["Up"] = "↑", ["Down"] = "↓", ["Left"] = "←", diff --git a/lua/keyseer/keyboard/dvorak.lua b/lua/keyseer/keyboard/dvorak.lua index edafaa2..9abf3c5 100644 --- a/lua/keyseer/keyboard/dvorak.lua +++ b/lua/keyseer/keyboard/dvorak.lua @@ -60,7 +60,7 @@ return Keyboard:new({ [10] = { normal = "n", shifted = "N" }, [11] = { normal = "s", shifted = "S" }, [12] = { normal = "-", shifted = "_" }, - [13] = { normal = "", shifted = "" }, + [13] = { normal = "", shifted = "" }, }, [5] = { [1] = { normal = "", shifted = "" }, diff --git a/lua/keyseer/keyboard/qwerty.lua b/lua/keyseer/keyboard/qwerty.lua index 43f33d6..873a363 100644 --- a/lua/keyseer/keyboard/qwerty.lua +++ b/lua/keyseer/keyboard/qwerty.lua @@ -60,7 +60,7 @@ return Keyboard:new({ [10] = { normal = "l", shifted = "L" }, [11] = { normal = ";", shifted = ":" }, [12] = { normal = "'", shifted = '"' }, - [13] = { normal = "", shifted = "" }, + [13] = { normal = "", shifted = "" }, }, [5] = { [1] = { normal = "", shifted = "" }, diff --git a/lua/keyseer/keymaps/keypress.lua b/lua/keyseer/keymaps/keypress.lua index e6f4bf2..775026b 100644 --- a/lua/keyseer/keymaps/keypress.lua +++ b/lua/keyseer/keymaps/keypress.lua @@ -74,6 +74,7 @@ function Keypress.get_keycode(keystring) "", "", "", + "", } if #key_presses > 1 then diff --git a/lua/keyseer/utils.lua b/lua/keyseer/utils.lua index 5755f87..f204992 100644 --- a/lua/keyseer/utils.lua +++ b/lua/keyseer/utils.lua @@ -75,6 +75,7 @@ function Utils.parse_keystring(keystr, split_keypresses) ["Space"] = "", ["Esc"] = "", ["BS"] = "", + ["CR"] = "", ["lt"] = "", ["F1"] = "", ["F2"] = "", diff --git a/tests/test_keymaps.lua b/tests/test_keymaps.lua index b4032fd..d69f9e5 100644 --- a/tests/test_keymaps.lua +++ b/tests/test_keymaps.lua @@ -208,6 +208,7 @@ T["keypress"]["finds keycodes"] = function() eq_global(child, "Keypress.get_keycode('')", "") eq_global(child, "Keypress.get_keycode('')", "") eq_global(child, "Keypress.get_keycode('')", "") + eq_global(child, "Keypress.get_keycode('')", "") end return T diff --git a/tests/test_utils.lua b/tests/test_utils.lua index 3187a25..acf7335 100644 --- a/tests/test_utils.lua +++ b/tests/test_utils.lua @@ -51,6 +51,7 @@ T["utils"]["parses keystrings"] = function() eq_global(child, "utils.parse_keystring('')", { { "" } }) eq_global(child, "utils.parse_keystring('')", { { "" } }) eq_global(child, "utils.parse_keystring('')", { { "" } }) + eq_global(child, "utils.parse_keystring('')", { { "" } }) end T["buttons"] = MiniTest.new_set()