1
0
forked from aniani/vim

patch 8.2.4192: cannot use an import in 'printexpr'

Problem:    Cannot use an import in 'printexpr'.
Solution:   Set the script context when evaluating 'printexpr'.
This commit is contained in:
Bram Moolenaar
2022-01-23 13:44:35 +00:00
parent e15ebeffb3
commit 7ef4a2fe37
3 changed files with 41 additions and 0 deletions

View File

@@ -391,13 +391,21 @@ eval_charconvert(
eval_printexpr(char_u *fname, char_u *args)
{
int err = FALSE;
sctx_T saved_sctx = current_sctx;
sctx_T *ctx;
set_vim_var_string(VV_FNAME_IN, fname, -1);
set_vim_var_string(VV_CMDARG, args, -1);
ctx = get_option_sctx("printexpr");
if (ctx != NULL)
current_sctx = *ctx;
if (eval_to_bool(p_pexpr, &err, NULL, FALSE))
err = TRUE;
set_vim_var_string(VV_FNAME_IN, NULL, -1);
set_vim_var_string(VV_CMDARG, NULL, -1);
current_sctx = saved_sctx;
if (err)
{