From 095c0876c2010d6160df37cf057f2d0ad2c4501f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 25 Feb 2025 09:17:51 +0800 Subject: 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 --- src/nvim/eval/typval_defs.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/nvim/eval') diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 90b0d4e4a9..ddc2b154a4 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -286,14 +286,9 @@ typedef struct { scid_T sc_sid; ///< script ID int sc_seq; ///< sourcing sequence number linenr_T sc_lnum; ///< line number + uint64_t sc_chan; ///< Only used when sc_sid is SID_API_CLIENT. } sctx_T; -/// Stores an identifier of a script or channel that last set an option. -typedef struct { - sctx_T script_ctx; /// script context where the option was last set - uint64_t channel_id; /// Only used when script_id is SID_API_CLIENT. -} LastSet; - enum { MAX_FUNC_ARGS = 20, }; ///< Maximum number of function arguments enum { VAR_SHORT_LEN = 20, }; ///< Short variable name length enum { FIXVAR_CNT = 12, }; ///< Number of fixed variables used for arguments -- cgit