mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 01:08:20 +00:00
vim-patch:8.1.2145: cannot map <C-H> when modifyOtherKeys is enabled
Problem: Cannot map <C-H> when modifyOtherKeys is enabled.
Solution: Add the <C-H> mapping twice, both with modifier and as 0x08. Use
only the first one when modifyOtherKeys has been detected.
459fd785e4
Add REPTERM_NO_SPECIAL instead of REPTERM_SPECIAL because the meaning of
"special" is different between Vim and Nvim.
Omit seenModifyOtherKeys as Nvim supports attaching multiple UIs.
Omit tests as they send terminal codes.
Keep the behavior of API functions.
This commit is contained in:
@@ -6,6 +6,7 @@ local eq = helpers.eq
|
||||
local neq = helpers.neq
|
||||
|
||||
local keymap = helpers.cimport("./src/nvim/keymap.h")
|
||||
local NULL = helpers.NULL
|
||||
|
||||
describe('keymap.c', function()
|
||||
|
||||
@@ -15,12 +16,12 @@ describe('keymap.c', function()
|
||||
|
||||
itp('no keycode', function()
|
||||
srcp[0] = 'abc'
|
||||
eq(0, keymap.find_special_key(srcp, 3, modp, false, false, false))
|
||||
eq(0, keymap.find_special_key(srcp, 3, modp, false, false, false, false, NULL))
|
||||
end)
|
||||
|
||||
itp('keycode with multiple modifiers', function()
|
||||
srcp[0] = '<C-M-S-A>'
|
||||
neq(0, keymap.find_special_key(srcp, 9, modp, false, false, false))
|
||||
neq(0, keymap.find_special_key(srcp, 9, modp, false, false, false, false, NULL))
|
||||
neq(0, modp[0])
|
||||
end)
|
||||
|
||||
@@ -28,22 +29,22 @@ describe('keymap.c', function()
|
||||
-- Compare other capitalizations to this.
|
||||
srcp[0] = '<C-A>'
|
||||
local all_caps_key =
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false)
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false, false, NULL)
|
||||
local all_caps_mod = modp[0]
|
||||
|
||||
srcp[0] = '<C-a>'
|
||||
eq(all_caps_key,
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false))
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false, false, NULL))
|
||||
eq(all_caps_mod, modp[0])
|
||||
|
||||
srcp[0] = '<c-A>'
|
||||
eq(all_caps_key,
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false))
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false, false, NULL))
|
||||
eq(all_caps_mod, modp[0])
|
||||
|
||||
srcp[0] = '<c-a>'
|
||||
eq(all_caps_key,
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false))
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false, false, NULL))
|
||||
eq(all_caps_mod, modp[0])
|
||||
end)
|
||||
|
||||
@@ -51,20 +52,20 @@ describe('keymap.c', function()
|
||||
-- Unescaped with in_string=false
|
||||
srcp[0] = '<C-">'
|
||||
eq(string.byte('"'),
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false))
|
||||
keymap.find_special_key(srcp, 5, modp, false, false, false, false, NULL))
|
||||
|
||||
-- Unescaped with in_string=true
|
||||
eq(0, keymap.find_special_key(srcp, 5, modp, false, false, true))
|
||||
eq(0, keymap.find_special_key(srcp, 5, modp, false, false, true, false, NULL))
|
||||
|
||||
-- Escaped with in_string=false
|
||||
srcp[0] = '<C-\\">'
|
||||
-- Should fail because the key is invalid
|
||||
-- (more than 1 non-modifier character).
|
||||
eq(0, keymap.find_special_key(srcp, 6, modp, false, false, false))
|
||||
eq(0, keymap.find_special_key(srcp, 6, modp, false, false, false, false, NULL))
|
||||
|
||||
-- Escaped with in_string=true
|
||||
eq(string.byte('"'),
|
||||
keymap.find_special_key(srcp, 6, modp, false, false, true))
|
||||
keymap.find_special_key(srcp, 6, modp, false, false, true, false, NULL))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
Reference in New Issue
Block a user