aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-12-25 12:57:09 -0500
committerJustin M. Keyes <justinkz@gmail.com>2014-12-25 12:57:09 -0500
commit7231a23cf651f8d950f53d4537e650085a41fb66 (patch)
treea923fb1b02d7b91621d0cb118f2455a5c11d835b
parentf13b90c064e817664f48bb7f0ce3e69cd54943c7 (diff)
parente06159e6ae907c50e2f36ad491297d23cb97487a (diff)
downloadrneovim-7231a23cf651f8d950f53d4537e650085a41fb66.tar.gz
rneovim-7231a23cf651f8d950f53d4537e650085a41fb66.tar.bz2
rneovim-7231a23cf651f8d950f53d4537e650085a41fb66.zip
Merge pull request #1722 from fwalch/vim-7.4.488
vim-patch:7.4.483, vim-patch:7.4.485, vim-patch:7.4.488
-rw-r--r--src/nvim/getchar.c24
-rw-r--r--src/nvim/version.c6
-rw-r--r--test/functional/legacy/mapping_spec.lua26
3 files changed, 50 insertions, 6 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 882d30388c..39227cc199 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -15,6 +15,7 @@
* mappings and abbreviations
*/
+#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <inttypes.h>
@@ -3637,11 +3638,28 @@ int check_abbr(int c, char_u *ptr, int col, int mincol)
for (; mp;
mp->m_next == NULL ? (mp = mp2, mp2 = NULL) :
(mp = mp->m_next)) {
+ int qlen = mp->m_keylen;
+ char_u *q = mp->m_keys;
+ int match;
+
+ if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL) {
+ /* might have CSI escaped mp->m_keys */
+ q = vim_strsave(mp->m_keys);
+ if (q != NULL) {
+ vim_unescape_csi(q);
+ qlen = (int)STRLEN(q);
+ }
+ }
/* find entries with right mode and keys */
- if ( (mp->m_mode & State)
- && mp->m_keylen == len
- && !STRNCMP(mp->m_keys, ptr, (size_t)len))
+ match = (mp->m_mode & State)
+ && qlen == len
+ && !STRNCMP(q, ptr, (size_t)len);
+ if (q != mp->m_keys) {
+ free(q);
+ }
+ if (match) {
break;
+ }
}
if (mp != NULL) {
/*
diff --git a/src/nvim/version.c b/src/nvim/version.c
index b469d0e804..a63798f80c 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -250,12 +250,12 @@ static int included_patches[] = {
491,
//490,
489,
- //488,
+ 488,
//487,
//486,
- //485,
+ 485,
//484 NA
- //483,
+ 483,
//482 NA
//481 NA
//480 NA
diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua
new file mode 100644
index 0000000000..46d29d1692
--- /dev/null
+++ b/test/functional/legacy/mapping_spec.lua
@@ -0,0 +1,26 @@
+-- Test for mappings and abbreviations
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('mapping', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ test starts here:
+ ]])
+
+ execute('set encoding=utf-8')
+
+ -- Abbreviations with р (0x80) should work.
+ execute('inoreab чкпр vim')
+ feed('GAчкпр <cr><esc>')
+
+ -- Assert buffer contents.
+ expect([[
+ test starts here:
+ vim]])
+ end)
+end)