mirror of https://github.com/folke/lazy.nvim.git
fix(keys): replace term codes to calculate ids
This commit is contained in:
parent
9223c1aa20
commit
d65a3d6755
|
@ -19,7 +19,7 @@ function M.parse(value)
|
|||
local ret = vim.deepcopy(value)
|
||||
ret = type(ret) == "string" and { ret } or ret --[[@as LazyKeys]]
|
||||
ret.mode = ret.mode or "n"
|
||||
ret.id = (ret[1] or "")
|
||||
ret.id = vim.api.nvim_replace_termcodes(ret[1] or "", true, true, true)
|
||||
if ret.mode then
|
||||
local mode = ret.mode
|
||||
if type(mode) == "table" then
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
local Keys = require("lazy.core.handler.keys")
|
||||
|
||||
describe("keys", function()
|
||||
it("parses ids correctly", function()
|
||||
local tests = {
|
||||
{ "<C-/>", "<c-/>", true },
|
||||
{ "<C-h>", "<c-H>", true },
|
||||
{ "<C-h>k", "<c-H>K", false },
|
||||
}
|
||||
for _, test in ipairs(tests) do
|
||||
if test[3] then
|
||||
assert.same(Keys.parse(test[1]).id, Keys.parse(test[2]).id)
|
||||
else
|
||||
assert.is_not.same(Keys.parse(test[1]).id, Keys.parse(test[2]).id)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue