0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.4173: cannot use an import in 'foldexpr'

Problem:    Cannot use an import in 'foldexpr'.
Solution:   Set the script context to where 'foldexpr' was set. (closes #9584)
            Fix that the script context was not set for all buffers.
This commit is contained in:
Bram Moolenaar
2022-01-21 16:31:11 +00:00
parent 6517f14165
commit e70dd11ef4
7 changed files with 59 additions and 9 deletions

View File

@@ -772,7 +772,7 @@ call_func_retlist(
return rettv.vval.v_list;
}
#ifdef FEAT_FOLDING
#if defined(FEAT_FOLDING) || defined(PROTO)
/*
* Evaluate "arg", which is 'foldexpr'.
* Note: caller must set "curwin" to match "arg".
@@ -780,14 +780,19 @@ call_func_retlist(
* give error messages.
*/
int
eval_foldexpr(char_u *arg, int *cp)
eval_foldexpr(win_T *wp, int *cp)
{
char_u *arg;
typval_T tv;
varnumber_T retval;
char_u *s;
sctx_T saved_sctx = current_sctx;
int use_sandbox = was_set_insecurely((char_u *)"foldexpr",
OPT_LOCAL);
arg = wp->w_p_fde;
current_sctx = wp->w_p_script_ctx[WV_FDE];
++emsg_off;
if (use_sandbox)
++sandbox;
@@ -818,6 +823,7 @@ eval_foldexpr(char_u *arg, int *cp)
--sandbox;
--textwinlock;
clear_evalarg(&EVALARG_EVALUATE, NULL);
current_sctx = saved_sctx;
return (int)retval;
}