summaryrefslogtreecommitdiffstats
path: root/src/beval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-01-22 15:09:36 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-22 15:09:36 +0000
commit5600a709f453045c80f92087acc0f855b4af377a (patch)
tree7a5d7a0ea30f2167bf7a1fd68a93d6c9570c3e6c /src/beval.c
parent9530b580a7b71960dbbdb2b12a3aafeb540bd135 (diff)
patch 8.2.4180: 'balloonexpr' is evaluated in the current script contextv8.2.4180
Problem: 'balloonexpr' is evaluated in the current script context. Solution: Use the script context where the option was set.
Diffstat (limited to 'src/beval.c')
-rw-r--r--src/beval.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/beval.c b/src/beval.c
index 8b7570b575..a9d10a202e 100644
--- a/src/beval.c
+++ b/src/beval.c
@@ -259,6 +259,8 @@ general_beval_cb(BalloonEval *beval, int state UNUSED)
: 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 @@ general_beval_cb(BalloonEval *beval, int state UNUSED)
++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 @@ general_beval_cb(BalloonEval *beval, int state UNUSED)
if (use_sandbox)
--sandbox;
--textwinlock;
+ current_sctx = save_sctx;
set_vim_var_string(VV_BEVAL_TEXT, NULL, -1);
if (result != NULL && result[0] != NUL)