diff options
| author | lePerdu <zdpeltzer@gmail.com> | 2017-10-18 18:27:31 -0400 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2018-01-18 01:37:51 +0100 |
| commit | bc17ad31dccb446fc24e0f6bb3cb2149ce951ae5 (patch) | |
| tree | b1dcb4b23fe3d7addd300abc532ebe215b546a5a /src/nvim/keymap.c | |
| parent | 8fc437ef43dbaccf873c9af448495387410e465c (diff) | |
| download | rneovim-bc17ad31dccb446fc24e0f6bb3cb2149ce951ae5.tar.gz rneovim-bc17ad31dccb446fc24e0f6bb3cb2149ce951ae5.tar.bz2 rneovim-bc17ad31dccb446fc24e0f6bb3cb2149ce951ae5.zip | |
os/input.c: parse keycodes in non-string context #7411
cb02137dfac7 had two mistakes, of the same nature: trans_special() must
be invoked with in_string=false unless the parsing context is a VimL
string. replace_termcodes() and input_enqueue() are low-level
mechanisms where VimL strings do not exist.
keymap.c: adjust double-quote case to satisfy keymap_spec.lua
closes #7410
Diffstat (limited to 'src/nvim/keymap.c')
| -rw-r--r-- | src/nvim/keymap.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 0eb5a41b1e..eb0653c432 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -481,7 +481,7 @@ char_u *get_special_key_name(int c, int modifiers) return string; } -/// Try translating a <> name +/// Try translating a <> name ("keycode"). /// /// @param[in,out] srcp Source from which <> are translated. Is advanced to /// after the <> name if there is a match. @@ -619,9 +619,11 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp, // Modifier with single letter, or special key name. if (in_string && last_dash[1] == '\\' && last_dash[2] == '"') { - off = 2; + // Special case for a double-quoted string + off = l = 2; + } else { + l = mb_ptr2len(last_dash + 1); } - l = mb_ptr2len(last_dash + 1); if (modifiers != 0 && last_dash[l + 1] == '>') { key = PTR2CHAR(last_dash + off); } else { @@ -834,7 +836,7 @@ char_u *replace_termcodes(const char_u *from, const size_t from_len, } slen = trans_special(&src, (size_t)(end - src) + 1, result + dlen, true, - true); + false); if (slen) { dlen += slen; continue; |