diff src/evalvars.c @ 27330:aeadf4315bef v8.2.4193

patch 8.2.4193: cannot use an import in 'charconvert' Commit: https://github.com/vim/vim/commit/f4e88f2152c5975a6f4cfa7ccd745575fe4d1c78 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 23 14:17:28 2022 +0000 patch 8.2.4193: cannot use an import in 'charconvert' Problem: Cannot use an import in 'charconvert'. Solution: Set the script context when evaluating 'charconvert'. Also expand script-local functions in 'charconvert'.
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Jan 2022 15:30:03 +0100
parents 7382135dac01
children c62006deb5c1
line wrap: on
line diff
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -369,17 +369,25 @@ eval_charconvert(
     char_u	*fname_to)
 {
     int		err = FALSE;
+    sctx_T	saved_sctx = current_sctx;
+    sctx_T	*ctx;
 
     set_vim_var_string(VV_CC_FROM, enc_from, -1);
     set_vim_var_string(VV_CC_TO, enc_to, -1);
     set_vim_var_string(VV_FNAME_IN, fname_from, -1);
     set_vim_var_string(VV_FNAME_OUT, fname_to, -1);
+    ctx = get_option_sctx("charconvert");
+    if (ctx != NULL)
+	current_sctx = *ctx;
+
     if (eval_to_bool(p_ccv, &err, NULL, FALSE))
 	err = TRUE;
+
     set_vim_var_string(VV_CC_FROM, NULL, -1);
     set_vim_var_string(VV_CC_TO, NULL, -1);
     set_vim_var_string(VV_FNAME_IN, NULL, -1);
     set_vim_var_string(VV_FNAME_OUT, NULL, -1);
+    current_sctx = saved_sctx;
 
     if (err)
 	return FAIL;