vim-patch:7.4.485

Problem:    Abbreviations don't work. (Toothpik)
Solution:   Move the length computation inside the for loop.  Compare against
	    the unescaped key.

https://code.google.com/p/vim/source/detail?r=v7-4-485
This commit is contained in:
Florian Walch 2014-12-23 12:40:23 +01:00
parent 6aecbbebfd
commit 0b192bf990
2 changed files with 21 additions and 16 deletions

View File

@ -3573,7 +3573,6 @@ int check_abbr(int c, char_u *ptr, int col, int mincol)
int clen = 0; /* length in characters */
int is_id = TRUE;
int vim_abbr;
int qlen; /* length of q, CSI/K_SPECIAL unescaped */
if (typebuf.tb_no_abbr_cnt) /* abbrev. are not recursive */
return FALSE;
@ -3636,25 +3635,31 @@ int check_abbr(int c, char_u *ptr, int col, int mincol)
mp = mp2;
mp2 = NULL;
}
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);
free(q);
}
}
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)
&& qlen == 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) {
/*

View File

@ -253,7 +253,7 @@ static int included_patches[] = {
//488,
//487,
//486,
//485,
485,
//484 NA
483,
//482 NA