summaryrefslogtreecommitdiffstats
path: root/src/indent.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-01-22 20:32:00 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-22 20:32:00 +0000
commit28e60cc088cadd25afb69ee636f0e2e34233ba4e (patch)
tree91411940fc4d481986c843cc351f83bdcba32512 /src/indent.c
parent47bcc5f4c83c158f43ac2ea7abfe99dbf5c2e098 (diff)
patch 8.2.4185: cannot use an import in 'indentexpr'v8.2.4185
Problem: Cannot use an import in 'indentexpr'. Solution: Set the script context when evaluating 'indentexpr'
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/indent.c b/src/indent.c
index a1012d2689..8dd4ef99cd 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1829,6 +1829,7 @@ get_expr_indent(void)
int save_State;
int use_sandbox = was_set_insecurely((char_u *)"indentexpr",
OPT_LOCAL);
+ sctx_T save_sctx = current_sctx;
// Save and restore cursor position and curswant, in case it was changed
// via :normal commands
@@ -1839,6 +1840,7 @@ get_expr_indent(void)
if (use_sandbox)
++sandbox;
++textwinlock;
+ current_sctx = curbuf->b_p_script_ctx[BV_INDE];
// Need to make a copy, the 'indentexpr' option could be changed while
// evaluating it.
@@ -1852,6 +1854,7 @@ get_expr_indent(void)
if (use_sandbox)
--sandbox;
--textwinlock;
+ current_sctx = save_sctx;
// Restore the cursor position so that 'indentexpr' doesn't need to.
// Pretend to be in Insert mode, allow cursor past end of line for "o"