mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
getchar: allow <SID> in <Cmd> mapping
This commit is contained in:
parent
d0c8dfc578
commit
5056d40b16
@ -4315,8 +4315,14 @@ char_u * getcmdkeycmd(int promptc, void *cookie, int indent)
|
|||||||
EMSG(e_cmdmap_repeated);
|
EMSG(e_cmdmap_repeated);
|
||||||
aborted = true;
|
aborted = true;
|
||||||
} else if (IS_SPECIAL(c1)) {
|
} else if (IS_SPECIAL(c1)) {
|
||||||
EMSG2(e_cmdmap_key, get_special_key_name(c1, cmod));
|
if (c1 == K_SNR) {
|
||||||
aborted = true;
|
ga_append(&line_ga, (char)K_SPECIAL);
|
||||||
|
ga_append(&line_ga, (char)KS_EXTRA);
|
||||||
|
ga_append(&line_ga, (char)KE_SNR);
|
||||||
|
} else {
|
||||||
|
EMSG2(e_cmdmap_key, get_special_key_name(c1, cmod));
|
||||||
|
aborted = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ga_append(&line_ga, (char)c1);
|
ga_append(&line_ga, (char)c1);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ local eval = helpers.eval
|
|||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
|
local source = helpers.source
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
|
||||||
describe('mappings with <Cmd>', function()
|
describe('mappings with <Cmd>', function()
|
||||||
@ -794,5 +795,16 @@ describe('mappings with <Cmd>', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("works with <SID> mappings", function()
|
||||||
|
source([[
|
||||||
|
map <f2> <Cmd>call <SID>do_it()<Cr>
|
||||||
|
function! s:do_it()
|
||||||
|
let g:x = 10
|
||||||
|
endfunction
|
||||||
|
]])
|
||||||
|
feed('<f2>')
|
||||||
|
eq('', eval('v:errmsg'))
|
||||||
|
eq(10, eval('g:x'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user