diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-17 15:27:39 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-17 15:46:24 +0800 |
commit | f560c970591a2d8355768deb79a8bd41a56b43dc (patch) | |
tree | 25fd77ff84bb84ad8fba3eafeb36d72ac1c0fd91 | |
parent | cec42e07bc136f496135dfd8ed6e6c4d16a24e0d (diff) | |
download | rneovim-f560c970591a2d8355768deb79a8bd41a56b43dc.tar.gz rneovim-f560c970591a2d8355768deb79a8bd41a56b43dc.tar.bz2 rneovim-f560c970591a2d8355768deb79a8bd41a56b43dc.zip |
vim-patch:8.2.4193: cannot use an import in 'charconvert'
Problem: Cannot use an import in 'charconvert'.
Solution: Set the script context when evaluating 'charconvert'. Also expand
script-local functions in 'charconvert'.
https://github.com/vim/vim/commit/f4e88f2152c5975a6f4cfa7ccd745575fe4d1c78
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | src/nvim/eval.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 9a94d414f9..4096b5d0ee 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -647,19 +647,27 @@ void var_redir_stop(void) int eval_charconvert(const char *const enc_from, const char *const enc_to, const char *const fname_from, const char *const fname_to) { - bool err = false; + const sctx_T saved_sctx = current_sctx; set_vim_var_string(VV_CC_FROM, enc_from, -1); set_vim_var_string(VV_CC_TO, enc_to, -1); set_vim_var_string(VV_FNAME_IN, fname_from, -1); set_vim_var_string(VV_FNAME_OUT, fname_to, -1); + sctx_T *ctx = get_option_sctx("charconvert"); + if (ctx != NULL) { + current_sctx = *ctx; + } + + bool err = false; if (eval_to_bool(p_ccv, &err, NULL, false)) { err = true; } + set_vim_var_string(VV_CC_FROM, NULL, -1); set_vim_var_string(VV_CC_TO, NULL, -1); set_vim_var_string(VV_FNAME_IN, NULL, -1); set_vim_var_string(VV_FNAME_OUT, NULL, -1); + current_sctx = saved_sctx; if (err) { return FAIL; |