1
0
forked from aniani/vim

patch 8.2.4059: Vim9: an expression of a map cannot access script-local items

Problem:    Vim9: an expression of a map cannot access script-local items.
            (Maxim Kim)
Solution:   Use the script ID of where the map was defined.
This commit is contained in:
Bram Moolenaar
2022-01-11 11:58:19 +00:00
parent 762838218f
commit 19db9e6ba7
5 changed files with 58 additions and 9 deletions

View File

@@ -2785,7 +2785,6 @@ handle_mapping(
int save_m_noremap;
int save_m_silent;
char_u *save_m_keys;
char_u *save_m_str;
#else
# define save_m_noremap mp->m_noremap
# define save_m_silent mp->m_silent
@@ -2834,7 +2833,6 @@ handle_mapping(
save_m_noremap = mp->m_noremap;
save_m_silent = mp->m_silent;
save_m_keys = NULL; // only saved when needed
save_m_str = NULL; // only saved when needed
/*
* Handle ":map <expr>": evaluate the {rhs} as an expression. Also
@@ -2851,8 +2849,7 @@ handle_mapping(
may_garbage_collect = FALSE;
save_m_keys = vim_strsave(mp->m_keys);
save_m_str = vim_strsave(mp->m_str);
map_str = eval_map_expr(save_m_str, NUL);
map_str = eval_map_expr(mp, NUL);
// The mapping may do anything, but we expect it to take care of
// redrawing. Do put the cursor back where it was.
@@ -2900,7 +2897,6 @@ handle_mapping(
}
#ifdef FEAT_EVAL
vim_free(save_m_keys);
vim_free(save_m_str);
#endif
*keylenp = keylen;
if (i == FAIL)