mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 00:38:17 +00:00
vim-patch:8.2.4173: cannot use an import in 'foldexpr' (#25215)
Problem: Cannot use an import in 'foldexpr'.
Solution: Set the script context to where 'foldexpr' was set. (closes vim/vim#9584)
Fix that the script context was not set for all buffers.
e70dd11ef4
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -1271,8 +1271,11 @@ void *call_func_retlist(const char *func, int argc, typval_T *argv)
|
||||
/// it in "*cp". Doesn't give error messages.
|
||||
int eval_foldexpr(win_T *wp, int *cp)
|
||||
{
|
||||
const sctx_T saved_sctx = current_sctx;
|
||||
const bool use_sandbox = was_set_insecurely(wp, "foldexpr", OPT_LOCAL);
|
||||
|
||||
char *arg = wp->w_p_fde;
|
||||
current_sctx = wp->w_p_script_ctx[WV_FDE].script_ctx;
|
||||
|
||||
emsg_off++;
|
||||
if (use_sandbox) {
|
||||
@@ -1309,6 +1312,7 @@ int eval_foldexpr(win_T *wp, int *cp)
|
||||
}
|
||||
textlock--;
|
||||
clear_evalarg(&EVALARG_EVALUATE, NULL);
|
||||
current_sctx = saved_sctx;
|
||||
|
||||
return (int)retval;
|
||||
}
|
||||
|
Reference in New Issue
Block a user