mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 23:18:33 +00:00
vim-patch:8.2.4179: 'foldtext' is evaluated in the current script context
Problem: 'foldtext' is evaluated in the current script context.
Solution: Use the script context where the option was set.
9530b580a7
Script version is N/A.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -1742,16 +1742,19 @@ char *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldinfo
|
|||||||
set_vim_var_string(VV_FOLDDASHES, dashes, -1);
|
set_vim_var_string(VV_FOLDDASHES, dashes, -1);
|
||||||
set_vim_var_nr(VV_FOLDLEVEL, (varnumber_T)level);
|
set_vim_var_nr(VV_FOLDLEVEL, (varnumber_T)level);
|
||||||
|
|
||||||
// skip evaluating foldtext on errors
|
// skip evaluating 'foldtext' on errors
|
||||||
if (!got_fdt_error) {
|
if (!got_fdt_error) {
|
||||||
win_T *save_curwin = curwin;
|
win_T *const save_curwin = curwin;
|
||||||
|
const sctx_T saved_sctx = current_sctx;
|
||||||
|
|
||||||
curwin = wp;
|
curwin = wp;
|
||||||
curbuf = wp->w_buffer;
|
curbuf = wp->w_buffer;
|
||||||
|
current_sctx = wp->w_p_script_ctx[WV_FDT].script_ctx;
|
||||||
|
|
||||||
emsg_silent++; // handle exceptions, but don't display errors
|
emsg_off++; // handle exceptions, but don't display errors
|
||||||
text = eval_to_string_safe(wp->w_p_fdt,
|
text = eval_to_string_safe(wp->w_p_fdt,
|
||||||
was_set_insecurely(wp, "foldtext", OPT_LOCAL));
|
was_set_insecurely(wp, "foldtext", OPT_LOCAL));
|
||||||
emsg_silent--;
|
emsg_off--;
|
||||||
|
|
||||||
if (text == NULL || did_emsg) {
|
if (text == NULL || did_emsg) {
|
||||||
got_fdt_error = true;
|
got_fdt_error = true;
|
||||||
@@ -1759,6 +1762,7 @@ char *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldinfo
|
|||||||
|
|
||||||
curwin = save_curwin;
|
curwin = save_curwin;
|
||||||
curbuf = curwin->w_buffer;
|
curbuf = curwin->w_buffer;
|
||||||
|
current_sctx = saved_sctx;
|
||||||
}
|
}
|
||||||
last_lnum = lnum;
|
last_lnum = lnum;
|
||||||
last_wp = wp;
|
last_wp = wp;
|
||||||
|
Reference in New Issue
Block a user