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:
10
src/eval.c
10
src/eval.c
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user