diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-17 15:30:42 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-17 15:46:24 +0800 |
commit | 481c6e6cac1d7219098408af5c396bada065be64 (patch) | |
tree | 895cac584825991d1bf32370faa3abea4be89cc0 | |
parent | f560c970591a2d8355768deb79a8bd41a56b43dc (diff) | |
download | rneovim-481c6e6cac1d7219098408af5c396bada065be64.tar.gz rneovim-481c6e6cac1d7219098408af5c396bada065be64.tar.bz2 rneovim-481c6e6cac1d7219098408af5c396bada065be64.zip |
vim-patch:8.2.4197: cannot use an import in the "expr" part of 'spellsuggest'
Problem: Cannot use an import in the "expr" part of 'spellsuggest'.
Solution: Set the script context when evaluating "expr" of 'spellsuggest'.
https://github.com/vim/vim/commit/2a7aa834583dea157eccf3e69827d2ff1d9fe9c7
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | src/nvim/eval.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 4096b5d0ee..28ac1f3fbd 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1085,6 +1085,7 @@ list_T *eval_spell_expr(char *badword, char *expr) typval_T rettv; list_T *list = NULL; char *p = skipwhite(expr); + const sctx_T saved_sctx = current_sctx; // Set "v:val" to the bad word. prepare_vimvar(VV_VAL, &save_val); @@ -1093,6 +1094,10 @@ list_T *eval_spell_expr(char *badword, char *expr) if (p_verbose == 0) { emsg_off++; } + sctx_T *ctx = get_option_sctx("spellsuggest"); + if (ctx != NULL) { + current_sctx = *ctx; + } if (eval1(&p, &rettv, &EVALARG_EVALUATE) == OK) { if (rettv.v_type != VAR_LIST) { @@ -1106,6 +1111,7 @@ list_T *eval_spell_expr(char *badword, char *expr) emsg_off--; } restore_vimvar(VV_VAL, &save_val); + current_sctx = saved_sctx; return list; } |