diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-23 17:59:06 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-23 17:59:06 +0000 |
commit | 2a7aa834583dea157eccf3e69827d2ff1d9fe9c7 (patch) | |
tree | 9ee271aec0458c30d1b40e91fa987e281eed3947 /src/evalvars.c | |
parent | 428058ab3213e81531cbd7989f4267870f35d52e (diff) |
patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'v8.2.4197
Problem: Cannot use an import in the "expr" part of 'spellsuggest'.
Solution: Set the script context when evaluating "expr" of 'spellsuggest'.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index 305ffe5488..bd8cc73a12 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -495,12 +495,17 @@ eval_spell_expr(char_u *badword, char_u *expr) typval_T rettv; list_T *list = NULL; char_u *p = skipwhite(expr); + sctx_T saved_sctx = current_sctx; + sctx_T *ctx; // Set "v:val" to the bad word. prepare_vimvar(VV_VAL, &save_val); set_vim_var_string(VV_VAL, badword, -1); if (p_verbose == 0) ++emsg_off; + ctx = get_option_sctx("spellsuggest"); + if (ctx != NULL) + current_sctx = *ctx; if (eval1(&p, &rettv, &EVALARG_EVALUATE) == OK) { @@ -514,6 +519,7 @@ eval_spell_expr(char_u *badword, char_u *expr) --emsg_off; clear_tv(get_vim_var_tv(VV_VAL)); restore_vimvar(VV_VAL, &save_val); + current_sctx = saved_sctx; return list; } |