From 4e42719355b7e1c968c7de0c51588bd744cdf034 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 10 Mar 2006 21:34:27 +0000 Subject: updated for version 7.0220 --- src/getchar.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 10 deletions(-) (limited to 'src/getchar.c') diff --git a/src/getchar.c b/src/getchar.c index 5064c8d39..5aa1b2594 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1792,8 +1792,8 @@ vgetorpeek(advance) int local_State; int mlen; int max_mlen; -#ifdef FEAT_CMDL_INFO int i; +#ifdef FEAT_CMDL_INFO int new_wcol, new_wrow; #endif #ifdef FEAT_GUI @@ -2309,6 +2309,17 @@ vgetorpeek(advance) } #endif +#ifdef FEAT_EVAL + /* + * Handle ":map ": evaluate the {rhs} as an + * expression. + */ + if (mp->m_expr) + s = eval_to_string(mp->m_str, NULL, FALSE); + else +#endif + s = mp->m_str; + /* * Insert the 'to' part in the typebuf.tb_buf. * If 'from' field is the same as the start of the @@ -2317,13 +2328,23 @@ vgetorpeek(advance) * If m_noremap is set, don't remap the whole 'to' * part. */ - if (ins_typebuf(mp->m_str, - mp->m_noremap != REMAP_YES + if (s == NULL) + i = FAIL; + else + { + i = ins_typebuf(s, + mp->m_noremap != REMAP_YES ? mp->m_noremap - : STRNCMP(mp->m_str, mp->m_keys, + : STRNCMP(s, mp->m_keys, (size_t)keylen) != 0 ? REMAP_YES : REMAP_SKIP, - 0, TRUE, cmd_silent || mp->m_silent) == FAIL) + 0, TRUE, cmd_silent || mp->m_silent); +#ifdef FEAT_EVAL + if (mp->m_expr) + vim_free(s); +#endif + } + if (i == FAIL) { c = -1; break; @@ -2955,6 +2976,9 @@ do_map(maptype, arg, mode, abbrev) mapblock_T **map_table; int unique = FALSE; int silent = FALSE; +#ifdef FEAT_EVAL + int expr = FALSE; +#endif int noremap; keys = arg; @@ -2967,7 +2991,7 @@ do_map(maptype, arg, mode, abbrev) else noremap = REMAP_YES; - /* Accept , ,