fix(api): don't override Vimscript SID (#32610)

Problem:  When calling an API from Vimscript to set an option, mapping,
          etc., :verbose shows that it's set from an API client.
Solution: Don't override current_sctx.sc_sid when calling an API from
          Vimscript. Also fix the inverse case where API channel id is
          not set when calling an API from RPC. Move channel id into
          sctx_T to make saving and restoring easier.

Related #8329
This commit is contained in:
zeertzjq
2025-02-25 09:17:51 +08:00
committed by GitHub
parent 614c9322d5
commit 095c0876c2
16 changed files with 237 additions and 118 deletions

View File

@@ -1731,7 +1731,7 @@ char *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldinfo
curwin = wp;
curbuf = wp->w_buffer;
current_sctx = wp->w_p_script_ctx[kWinOptFoldtext].script_ctx;
current_sctx = wp->w_p_script_ctx[kWinOptFoldtext];
emsg_off++; // handle exceptions, but don't display errors