patch 8.2.4180: 'balloonexpr' is evaluated in the current script context
Problem: 'balloonexpr' is evaluated in the current script context.
Solution: Use the script context where the option was set.
diff --git a/src/beval.c b/src/beval.c
index 8b7570b..a9d10a2 100644
--- a/src/beval.c
+++ b/src/beval.c
@@ -259,6 +259,8 @@
: wp->w_buffer->b_p_bexpr;
if (*bexpr != NUL)
{
+ sctx_T save_sctx = current_sctx;
+
// Convert window pointer to number.
for (cw = firstwin; cw != wp; cw = cw->w_next)
++winnr;
@@ -284,6 +286,16 @@
++sandbox;
++textwinlock;
+ if (bexpr == p_bexpr)
+ {
+ sctx_T *sp = get_option_sctx("balloonexpr");
+
+ if (sp != NULL)
+ current_sctx = *sp;
+ }
+ else
+ current_sctx = curbuf->b_p_script_ctx[BV_BEXPR];
+
vim_free(result);
result = eval_to_string(bexpr, TRUE);
@@ -300,6 +312,7 @@
if (use_sandbox)
--sandbox;
--textwinlock;
+ current_sctx = save_sctx;
set_vim_var_string(VV_BEVAL_TEXT, NULL, -1);
if (result != NULL && result[0] != NUL)