Mercurial > vim
diff src/getchar.c @ 27061:1a56c0252772 v8.2.4059
patch 8.2.4059: Vim9: an expression of a map cannot access script-local items
Commit: https://github.com/vim/vim/commit/19db9e6ba710ca32f0f5e0c2ca2ba69f8228b833
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 11 11:58:19 2022 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 11 Jan 2022 13:00:06 +0100 |
parents | 8d4b44cc324e |
children | a9eeb18e749c |
line wrap: on
line diff
--- a/src/getchar.c +++ b/src/getchar.c @@ -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)