0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.4.485

Problem:    Abbreviations don't work. (Toothpik)
Solution:   Move the length computation inside the for loop.  Compare against
            the unescaped key.
This commit is contained in:
Bram Moolenaar
2014-10-21 19:35:31 +02:00
parent cb5ea1401a
commit 4920a44271
2 changed files with 22 additions and 16 deletions

View File

@@ -4443,7 +4443,6 @@ 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;
@@ -4521,29 +4520,34 @@ 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 = (int)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) :
#endif #endif
(mp = mp->m_next)) (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 */ /* find entries with right mode and keys */
if ( (mp->m_mode & State) match = (mp->m_mode & State)
&& qlen == len && qlen == len
&& !STRNCMP(mp->m_keys, ptr, (size_t)len)) && !STRNCMP(q, ptr, (size_t)len);
if (q != mp->m_keys)
vim_free(q);
if (match)
break; break;
} }
if (mp != NULL) if (mp != NULL)

View File

@@ -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 */
/**/
485,
/**/ /**/
484, 484,
/**/ /**/