0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.0e02

This commit is contained in:
Bram Moolenaar
2006-04-18 21:55:01 +00:00
parent a93fa7ee78
commit c1e37901fc
46 changed files with 10995 additions and 4952 deletions

View File

@@ -128,6 +128,9 @@ static int vgetorpeek __ARGS((int));
static void map_free __ARGS((mapblock_T **));
static void validate_maphash __ARGS((void));
static void showmap __ARGS((mapblock_T *mp, int local));
#ifdef FEAT_EVAL
static char_u *eval_map_expr __ARGS((char_u *str));
#endif
/*
* Free and clear a buffer.
@@ -2328,7 +2331,7 @@ vgetorpeek(advance)
if (tabuf.typebuf_valid)
{
vgetc_busy = 0;
s = eval_to_string(mp->m_str, NULL, FALSE);
s = eval_map_expr(mp->m_str);
vgetc_busy = save_vgetc_busy;
}
else
@@ -4251,7 +4254,7 @@ check_abbr(c, ptr, col, mincol)
}
#ifdef FEAT_EVAL
if (mp->m_expr)
s = eval_to_string(mp->m_str, NULL, FALSE);
s = eval_map_expr(mp->m_str);
else
#endif
s = mp->m_str;
@@ -4281,6 +4284,36 @@ check_abbr(c, ptr, col, mincol)
return FALSE;
}
#ifdef FEAT_EVAL
/*
* Evaluate the RHS of a mapping or abbreviations and take care of escaping
* special characters.
*/
static char_u *
eval_map_expr(str)
char_u *str;
{
char_u *res;
char_u *s;
int len;
s = eval_to_string(str, NULL, FALSE);
if (s == NULL)
return NULL;
/* Need a buffer to hold up to three times as much. */
len = (int)STRLEN(s);
res = alloc((unsigned)(len * 3) + 1);
if (res != NULL)
{
STRCPY(res, s);
(void)fix_input_buffer(res, len, TRUE);
}
vim_free(s);
return res;
}
#endif
/*
* Write map commands for the current mappings to an .exrc file.
* Return FAIL on error, OK otherwise.