diff src/evalvars.c @ 27328:7382135dac01 v8.2.4192

patch 8.2.4192: cannot use an import in 'printexpr' Commit: https://github.com/vim/vim/commit/7ef4a2fe3736bbeb5bad182782a74576aa06b0db Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 23 13:44:35 2022 +0000 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'.
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Jan 2022 14:45:03 +0100
parents a195a900a329
children aeadf4315bef
line wrap: on
line diff
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -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)
     {