Merge pull request #10790 from bfredl/metamb

keymap: allow modifiers to multibyte chars, like <m-ä>
This commit is contained in:
Björn Linse
2019-08-16 19:56:37 +02:00
committed by GitHub
3 changed files with 9 additions and 1 deletions

View File

@@ -404,6 +404,9 @@ Mapping <kHome> will not work then.
Note: If numlock is on, the |TUI| receives plain ASCII values, so Note: If numlock is on, the |TUI| receives plain ASCII values, so
mappings to <k0> - <k9> and <kPoint> will not work. mappings to <k0> - <k9> and <kPoint> will not work.
Note: Nvim supports mapping multibyte chars with modifiers such as `<M-ä>`.
Which combinations actually are usable depends on the terminal emulator or GUI.
*<>* *<>*
Examples are often given in the <> notation. Sometimes this is just to make Examples are often given in the <> notation. Sometimes this is just to make
clear what you need to type, but often it can be typed literally, e.g., with clear what you need to type, but often it can be typed literally, e.g., with

View File

@@ -604,7 +604,7 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
// Anything accepted, like <C-?>. // Anything accepted, like <C-?>.
// <C-"> or <M-"> are not special in strings as " is // <C-"> or <M-"> are not special in strings as " is
// the string delimiter. With a backslash it works: <M-\"> // the string delimiter. With a backslash it works: <M-\">
if (end - bp > l && !(in_string && bp[1] == '"') && bp[2] == '>') { if (end - bp > l && !(in_string && bp[1] == '"') && bp[l+1] == '>') {
bp += l; bp += l;
} else if (end - bp > 2 && in_string && bp[1] == '\\' } else if (end - bp > 2 && in_string && bp[1] == '\\'
&& bp[2] == '"' && bp[3] == '>') { && bp[2] == '"' && bp[3] == '>') {

View File

@@ -103,6 +103,11 @@ describe('mappings', function()
check_mapping('<kequal>','<kequal>') check_mapping('<kequal>','<kequal>')
check_mapping('<KPEquals>','<kequal>') check_mapping('<KPEquals>','<kequal>')
end) end)
it('support meta + multibyte char mapping', function()
add_mapping('<m-ä>', '<m-ä>')
check_mapping('<m-ä>', '<m-ä>')
end)
end) end)
describe('feeding large chunks of input with <Paste>', function() describe('feeding large chunks of input with <Paste>', function()