mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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
This commit is contained in:
commit
7231a23cf6
@ -15,6 +15,7 @@
|
||||
* mappings and abbreviations
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
@ -3637,12 +3638,29 @@ 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) {
|
||||
/*
|
||||
* Found a match:
|
||||
|
@ -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
|
||||
|
26
test/functional/legacy/mapping_spec.lua
Normal file
26
test/functional/legacy/mapping_spec.lua
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user