diff options
author | Matthew Malcomson <hardenedapple@gmail.com> | 2017-04-03 15:59:41 +0100 |
---|---|---|
committer | Matthew Malcomson <hardenedapple@gmail.com> | 2018-03-14 10:39:14 +0000 |
commit | 8e71a26e1931e8e87e6db6e13b77dadd488790de (patch) | |
tree | 83dcce9e109ecdf7140c51974d938acc4c35daf5 /src | |
parent | 20bfe0f2a34a69f85af262fe350761f85776ad46 (diff) | |
download | rneovim-8e71a26e1931e8e87e6db6e13b77dadd488790de.tar.gz rneovim-8e71a26e1931e8e87e6db6e13b77dadd488790de.tar.bz2 rneovim-8e71a26e1931e8e87e6db6e13b77dadd488790de.zip |
Record :lmap transformed keys in gotchars()
The mental model of :lmap and 'keymap' is of a transformation done
before anything else. Hence when recording a macro, or writing to a
scriptfile, the transformed keys should be recorded instead of the keys
before the transformation.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/getchar.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 7df1bf8429..458c79ad4e 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1939,8 +1939,9 @@ static int vgetorpeek(int advance) char_u *save_m_keys; char_u *save_m_str; - // write chars to script file(s) - if (keylen > typebuf.tb_maplen) { + // Write chars to script file(s) + // Note: :lmap mappings are written *after* being applied. #5658 + if (keylen > typebuf.tb_maplen && (mp->m_mode & LANGMAP) == 0) { gotchars(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_maplen, (size_t)(keylen - typebuf.tb_maplen)); } @@ -2015,6 +2016,12 @@ static int vgetorpeek(int advance) else { int noremap; + // If this is a LANGMAP mapping, then we didn't record the keys + // at the start of the function and have to record them now. + if (keylen > typebuf.tb_maplen && (mp->m_mode & LANGMAP) != 0) { + gotchars(s, STRLEN(s)); + } + if (save_m_noremap != REMAP_YES) noremap = save_m_noremap; else if ( |