From 9530b580a7b71960dbbdb2b12a3aafeb540bd135 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 22 Jan 2022 13:39:08 +0000 Subject: patch 8.2.4179: 'foldtext' is evaluated in the current script context Problem: 'foldtext' is evaluated in the current script context. Solution: Use the script context where the option was set. --- src/eval.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/eval.c') diff --git a/src/eval.c b/src/eval.c index ec34ef13e2..2ca3377492 100644 --- a/src/eval.c +++ b/src/eval.c @@ -555,14 +555,16 @@ eval_to_string( char_u * eval_to_string_safe( char_u *arg, - int use_sandbox) + int use_sandbox, + int keep_script_version) { char_u *retval; funccal_entry_T funccal_entry; int save_sc_version = current_sctx.sc_version; int save_garbage = may_garbage_collect; - current_sctx.sc_version = 1; + if (!keep_script_version) + current_sctx.sc_version = 1; save_funccal(&funccal_entry); if (use_sandbox) ++sandbox; -- cgit v1.2.3