Skip to content

Commit

Permalink
fix: handle CR keypresses
Browse files Browse the repository at this point in the history
  • Loading branch information
jokajak committed Aug 6, 2023
1 parent eac6ead commit 8ed5d54
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/keyseer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Default values:
highlight_padding = { 0, 0, 0, 0 },
-- override the label used to display some keys.
key_labels = {
["<CR>"] = "<Enter>",
["Up"] = "↑",
["Down"] = "↓",
["Left"] = "←",
Expand Down
1 change: 1 addition & 0 deletions lua/keyseer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ KeySeer.config = {
highlight_padding = { 0, 0, 0, 0 },
-- override the label used to display some keys.
key_labels = {
["<CR>"] = "<Enter>",
["Up"] = "",
["Down"] = "",
["Left"] = "",
Expand Down
2 changes: 1 addition & 1 deletion lua/keyseer/keyboard/dvorak.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ return Keyboard:new({
[10] = { normal = "n", shifted = "N" },
[11] = { normal = "s", shifted = "S" },
[12] = { normal = "-", shifted = "_" },
[13] = { normal = "<Enter>", shifted = "<Enter>" },
[13] = { normal = "<CR>", shifted = "<CR>" },
},
[5] = {
[1] = { normal = "<Shift>", shifted = "<Shift>" },
Expand Down
2 changes: 1 addition & 1 deletion lua/keyseer/keyboard/qwerty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ return Keyboard:new({
[10] = { normal = "l", shifted = "L" },
[11] = { normal = ";", shifted = ":" },
[12] = { normal = "'", shifted = '"' },
[13] = { normal = "<Enter>", shifted = "<Enter>" },
[13] = { normal = "<CR>", shifted = "<CR>" },
},
[5] = {
[1] = { normal = "<Shift>", shifted = "<Shift>" },
Expand Down
1 change: 1 addition & 0 deletions lua/keyseer/keymaps/keypress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function Keypress.get_keycode(keystring)
"<F8>",
"<F9>",
"<F10>",
"<CR>",
}

if #key_presses > 1 then
Expand Down
1 change: 1 addition & 0 deletions lua/keyseer/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function Utils.parse_keystring(keystr, split_keypresses)
["Space"] = "<Space>",
["Esc"] = "<Esc>",
["BS"] = "<BS>",
["CR"] = "<CR>",
["lt"] = "<lt>",
["F1"] = "<F1>",
["F2"] = "<F2>",
Expand Down
1 change: 1 addition & 0 deletions tests/test_keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ T["keypress"]["finds keycodes"] = function()
eq_global(child, "Keypress.get_keycode('<Esc>')", "<Esc>")
eq_global(child, "Keypress.get_keycode('<F1>')", "<F1>")
eq_global(child, "Keypress.get_keycode('<F2>')", "<F2>")
eq_global(child, "Keypress.get_keycode('<CR>')", "<CR>")
end

return T
1 change: 1 addition & 0 deletions tests/test_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ T["utils"]["parses keystrings"] = function()
eq_global(child, "utils.parse_keystring('<lt>')", { { "<lt>" } })
eq_global(child, "utils.parse_keystring('<F1>')", { { "<F1>" } })
eq_global(child, "utils.parse_keystring('<F2>')", { { "<F2>" } })
eq_global(child, "utils.parse_keystring('<CR>')", { { "<CR>" } })
end

T["buttons"] = MiniTest.new_set()
Expand Down

0 comments on commit 8ed5d54

Please sign in to comment.