aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-17 15:24:40 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-17 15:46:24 +0800
commit5d3ad6fd9031040da856167d4672154149625e8f (patch)
tree841d37038c759a8292113289669a228b227fa437
parent96451e7f606947c33b11ca024fa76dedf47314b1 (diff)
downloadrneovim-5d3ad6fd9031040da856167d4672154149625e8f.tar.gz
rneovim-5d3ad6fd9031040da856167d4672154149625e8f.tar.bz2
rneovim-5d3ad6fd9031040da856167d4672154149625e8f.zip
vim-patch:8.2.4185: cannot use an import in 'indentexpr'
Problem: Cannot use an import in 'indentexpr'. Solution: Set the script context when evaluating 'indentexpr' https://github.com/vim/vim/commit/28e60cc088cadd25afb69ee636f0e2e34233ba4e Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--src/nvim/indent.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index 8a65e88545..1d8bceae4e 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -1122,6 +1122,7 @@ int get_expr_indent(void)
int save_set_curswant;
int save_State;
int use_sandbox = was_set_insecurely(curwin, "indentexpr", OPT_LOCAL);
+ const sctx_T save_sctx = current_sctx;
// Save and restore cursor position and curswant, in case it was changed
// * via :normal commands.
@@ -1134,6 +1135,7 @@ int get_expr_indent(void)
sandbox++;
}
textlock++;
+ current_sctx = curbuf->b_p_script_ctx[BV_INDE].script_ctx;
// Need to make a copy, the 'indentexpr' option could be changed while
// evaluating it.
@@ -1145,6 +1147,7 @@ int get_expr_indent(void)
sandbox--;
}
textlock--;
+ 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"