forked from aniani/vim
updated for version 7.4.483
Problem: A 0x80 byte is not handled correctly in abbreviations. Solution: Unescape special characters. Add a test. (Christian Brabandt)
This commit is contained in:
@@ -4443,6 +4443,7 @@ check_abbr(c, ptr, col, mincol)
|
|||||||
#endif
|
#endif
|
||||||
int is_id = TRUE;
|
int is_id = TRUE;
|
||||||
int vim_abbr;
|
int vim_abbr;
|
||||||
|
int qlen; /* length of q, CSI/K_SPECIAL unescaped */
|
||||||
|
|
||||||
if (typebuf.tb_no_abbr_cnt) /* abbrev. are not recursive */
|
if (typebuf.tb_no_abbr_cnt) /* abbrev. are not recursive */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -4520,6 +4521,19 @@ check_abbr(c, ptr, col, mincol)
|
|||||||
#else
|
#else
|
||||||
mp = first_abbr;
|
mp = first_abbr;
|
||||||
#endif
|
#endif
|
||||||
|
qlen = mp->m_keylen;
|
||||||
|
if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL)
|
||||||
|
{
|
||||||
|
char_u *q = vim_strsave(mp->m_keys);
|
||||||
|
|
||||||
|
/* might have CSI escaped mp->m_keys */
|
||||||
|
if (q != NULL)
|
||||||
|
{
|
||||||
|
vim_unescape_csi(q);
|
||||||
|
qlen = STRLEN(q);
|
||||||
|
vim_free(q);
|
||||||
|
}
|
||||||
|
}
|
||||||
for ( ; mp;
|
for ( ; mp;
|
||||||
#ifdef FEAT_LOCALMAP
|
#ifdef FEAT_LOCALMAP
|
||||||
mp->m_next == NULL ? (mp = mp2, mp2 = NULL) :
|
mp->m_next == NULL ? (mp = mp2, mp2 = NULL) :
|
||||||
@@ -4528,7 +4542,7 @@ check_abbr(c, ptr, col, mincol)
|
|||||||
{
|
{
|
||||||
/* find entries with right mode and keys */
|
/* find entries with right mode and keys */
|
||||||
if ( (mp->m_mode & State)
|
if ( (mp->m_mode & State)
|
||||||
&& mp->m_keylen == len
|
&& qlen == len
|
||||||
&& !STRNCMP(mp->m_keys, ptr, (size_t)len))
|
&& !STRNCMP(mp->m_keys, ptr, (size_t)len))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -43,6 +43,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
|||||||
test_insertcount.out \
|
test_insertcount.out \
|
||||||
test_listlbr.out \
|
test_listlbr.out \
|
||||||
test_listlbr_utf8.out \
|
test_listlbr_utf8.out \
|
||||||
|
test_mapping.out \
|
||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
@@ -42,6 +42,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
|||||||
test_insertcount.out \
|
test_insertcount.out \
|
||||||
test_listlbr.out \
|
test_listlbr.out \
|
||||||
test_listlbr_utf8.out \
|
test_listlbr_utf8.out \
|
||||||
|
test_mapping.out \
|
||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
@@ -62,6 +62,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
|||||||
test_insertcount.out \
|
test_insertcount.out \
|
||||||
test_listlbr.out \
|
test_listlbr.out \
|
||||||
test_listlbr_utf8.out \
|
test_listlbr_utf8.out \
|
||||||
|
test_mapping.out \
|
||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
@@ -44,6 +44,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
|||||||
test_insertcount.out \
|
test_insertcount.out \
|
||||||
test_listlbr.out \
|
test_listlbr.out \
|
||||||
test_listlbr_utf8.out \
|
test_listlbr_utf8.out \
|
||||||
|
test_mapping.out \
|
||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
@@ -103,6 +103,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
|
|||||||
test_insertcount.out \
|
test_insertcount.out \
|
||||||
test_listlbr.out \
|
test_listlbr.out \
|
||||||
test_listlbr_utf8.out \
|
test_listlbr_utf8.out \
|
||||||
|
test_mapping.out \
|
||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
@@ -40,6 +40,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
|||||||
test_insertcount.out \
|
test_insertcount.out \
|
||||||
test_listlbr.out \
|
test_listlbr.out \
|
||||||
test_listlbr_utf8.out \
|
test_listlbr_utf8.out \
|
||||||
|
test_mapping.out \
|
||||||
test_options.out \
|
test_options.out \
|
||||||
test_qf_title.out \
|
test_qf_title.out \
|
||||||
test_utf8.out
|
test_utf8.out
|
||||||
|
15
src/testdir/test_mapping.in
Normal file
15
src/testdir/test_mapping.in
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Test for mappings and abbreviations
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:so small.vim
|
||||||
|
:so mbyte.vim
|
||||||
|
: " abbreviations with р (0x80) should work
|
||||||
|
:inoreab чкпр vim
|
||||||
|
GAчкпр
|
||||||
|
|
||||||
|
:/^test/,$w! test.out
|
||||||
|
:qa!
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
test starts here:
|
||||||
|
|
2
src/testdir/test_mapping.ok
Normal file
2
src/testdir/test_mapping.ok
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
test starts here:
|
||||||
|
vim
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
483,
|
||||||
/**/
|
/**/
|
||||||
482,
|
482,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user