fix(mappings): fix mapset() not replacing map with backslash

(cherry picked from commit 5ac9b4cddf)
This commit is contained in:
zeertzjq
2023-12-23 15:07:25 +08:00
committed by github-actions[bot]
parent 2c3aca4205
commit d414938163
2 changed files with 11 additions and 1 deletions

View File

@@ -174,6 +174,16 @@ end)
describe('mapset()', function()
before_each(clear)
it('can restore mapping with backslash in lhs', function()
meths.set_keymap('n', '\\ab', 'a', {})
eq('\nn \\ab a', exec_capture("nmap \\ab"))
local mapargs = funcs.maparg('\\ab', 'n', false, true)
meths.set_keymap('n', '\\ab', 'b', {})
eq('\nn \\ab b', exec_capture("nmap \\ab"))
funcs.mapset('n', false, mapargs)
eq('\nn \\ab a', exec_capture("nmap \\ab"))
end)
it('can restore mapping description from the dict returned by maparg()', function()
meths.set_keymap('n', 'lhs', 'rhs', {desc = 'map description'})
eq('\nn lhs rhs\n map description', exec_capture("nmap lhs"))