aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-08-16 12:03:33 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-08-16 19:54:34 +0200
commit6fe2d24cef095bda797c2b33c1dadd4fac082945 (patch)
treea0cadd1f5e420a4c1655c0f04cb9fa3495f2a059
parent1f5eac1115a44a0f4794cb7fb6f99142cbd39c60 (diff)
downloadrneovim-6fe2d24cef095bda797c2b33c1dadd4fac082945.tar.gz
rneovim-6fe2d24cef095bda797c2b33c1dadd4fac082945.tar.bz2
rneovim-6fe2d24cef095bda797c2b33c1dadd4fac082945.zip
keymap: allow modifiers to multibyte chars, like <m-ä>
-rw-r--r--runtime/doc/intro.txt3
-rw-r--r--src/nvim/keymap.c2
-rw-r--r--test/functional/ui/input_spec.lua5
3 files changed, 9 insertions, 1 deletions
diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt
index 1fb06e169c..c240f08a75 100644
--- a/runtime/doc/intro.txt
+++ b/runtime/doc/intro.txt
@@ -404,6 +404,9 @@ Mapping <kHome> will not work then.
Note: If numlock is on, the |TUI| receives plain ASCII values, so
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
clear what you need to type, but often it can be typed literally, e.g., with
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 9145813525..27052da9d8 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -604,7 +604,7 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
// Anything accepted, like <C-?>.
// <C-"> or <M-"> are not special in strings as " is
// 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;
} else if (end - bp > 2 && in_string && bp[1] == '\\'
&& bp[2] == '"' && bp[3] == '>') {
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 121cbe47d6..0009f2c31b 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -103,6 +103,11 @@ describe('mappings', function()
check_mapping('<kequal>','<kequal>')
check_mapping('<KPEquals>','<kequal>')
end)
+
+ it('support meta + multibyte char mapping', function()
+ add_mapping('<m-ä>', '<m-ä>')
+ check_mapping('<m-ä>', '<m-ä>')
+ end)
end)
describe('feeding large chunks of input with <Paste>', function()