aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-17 21:01:19 +0800
committerGitHub <noreply@github.com>2023-09-17 21:01:19 +0800
commit211edceb4f4d4d0f6c41a6ee56891a6f9407e3a7 (patch)
tree20298a9ad289c16cdd5fc0a5c403a78958e32cc0 /src/nvim/eval.c
parent71530cc972576e6656431b6d000aec9b69a0997e (diff)
downloadrneovim-211edceb4f4d4d0f6c41a6ee56891a6f9407e3a7.tar.gz
rneovim-211edceb4f4d4d0f6c41a6ee56891a6f9407e3a7.tar.bz2
rneovim-211edceb4f4d4d0f6c41a6ee56891a6f9407e3a7.zip
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. https://github.com/vim/vim/commit/e70dd11ef41f69bd5e94f630194e6b3c4f3f2102 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index a279b6d051..21c7cdee7d 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -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;
}