This commit is contained in:
b-r-o-c-k 2018-05-10 22:31:55 -05:00
parent 7170de1971
commit e31d8ed36a
4 changed files with 36 additions and 33 deletions

View File

@ -237,7 +237,7 @@ typedef struct {
char_u *wo_winhl; char_u *wo_winhl;
# define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight' # define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight'
LastSet wo_scriptID[WV_COUNT]; /* SIDs for window-local options */ LastSet wo_scriptID[WV_COUNT]; // SIDs for window-local options
# define w_p_scriptID w_onebuf_opt.wo_scriptID # define w_p_scriptID w_onebuf_opt.wo_scriptID
} winopt_T; } winopt_T;
@ -590,7 +590,7 @@ struct file_buffer {
*/ */
bool b_p_initialized; /* set when options initialized */ bool b_p_initialized; /* set when options initialized */
LastSet b_p_scriptID[BV_COUNT]; /* SIDs for buffer-local options */ LastSet b_p_scriptID[BV_COUNT]; // SIDs for buffer-local options
int b_p_ai; ///< 'autoindent' int b_p_ai; ///< 'autoindent'
int b_p_ai_nopaste; ///< b_p_ai saved for paste mode int b_p_ai_nopaste; ///< b_p_ai saved for paste mode

View File

@ -22061,8 +22061,10 @@ int store_session_globals(FILE *fd)
*/ */
void last_set_msg(scid_T scriptID) void last_set_msg(scid_T scriptID)
{ {
LastSet last_set; const LastSet last_set = (LastSet){
last_set.script_id = scriptID; .script_id = scriptID,
.channel_id = 0,
};
option_last_set_msg(last_set); option_last_set_msg(last_set);
} }

View File

@ -390,19 +390,19 @@ EXTERN int may_garbage_collect INIT(= FALSE);
EXTERN int want_garbage_collect INIT(= FALSE); EXTERN int want_garbage_collect INIT(= FALSE);
EXTERN int garbage_collect_at_exit INIT(= FALSE); EXTERN int garbage_collect_at_exit INIT(= FALSE);
/* Special values for current_SID. */ // Special values for current_SID.
#define SID_MODELINE -1 /* when using a modeline */ #define SID_MODELINE -1 // when using a modeline
#define SID_CMDARG -2 /* for "--cmd" argument */ #define SID_CMDARG -2 // for "--cmd" argument
#define SID_CARG -3 /* for "-c" argument */ #define SID_CARG -3 // for "-c" argument
#define SID_ENV -4 /* for sourcing environment variable */ #define SID_ENV -4 // for sourcing environment variable
#define SID_ERROR -5 /* option was reset because of an error */ #define SID_ERROR -5 // option was reset because of an error
#define SID_NONE -6 /* don't set scriptID */ #define SID_NONE -6 // don't set scriptID
#define SID_LUA -7 /* for Lua scripts/chunks */ #define SID_LUA -7 // for Lua scripts/chunks
#define SID_API_CLIENT -8 /* for API clients */ #define SID_API_CLIENT -8 // for API clients
/* ID of script being sourced or was sourced to define the current function. */ // ID of script being sourced or was sourced to define the current function.
EXTERN scid_T current_SID INIT(= 0); EXTERN scid_T current_SID INIT(= 0);
/* ID of the current channel making a client API call */ // ID of the current channel making a client API call
EXTERN uint64_t current_channel_id INIT(= 0); EXTERN uint64_t current_channel_id INIT(= 0);
EXTERN bool did_source_packages INIT(= false); EXTERN bool did_source_packages INIT(= false);

View File

@ -187,16 +187,16 @@ static long p_tw_nopaste;
static long p_wm_nopaste; static long p_wm_nopaste;
typedef struct vimoption { typedef struct vimoption {
char *fullname; /* full option name */ char *fullname; // full option name
char *shortname; /* permissible abbreviation */ char *shortname; // permissible abbreviation
uint32_t flags; /* see below */ uint32_t flags; // see below
char_u *var; /* global option: pointer to variable; char_u *var; // global option: pointer to variable;
* window-local option: VAR_WIN; // window-local option: VAR_WIN;
* buffer-local option: global value */ // buffer-local option: global value
idopt_T indir; /* global option: PV_NONE; idopt_T indir; // global option: PV_NONE;
* local option: indirect option index */ // local option: indirect option index
char_u *def_val[2]; /* default values for variable (vi and vim) */ char_u *def_val[2]; // default values for variable (vi and vim)
LastSet last_set; /* script in which the option was last set */ LastSet last_set; // script in which the option was last set
# define SCRIPTID_INIT , 0 # define SCRIPTID_INIT , 0
} vimoption_T; } vimoption_T;
@ -1366,16 +1366,17 @@ do_set (
if (opt_idx >= 0) { if (opt_idx >= 0) {
showoneopt(&options[opt_idx], opt_flags); showoneopt(&options[opt_idx], opt_flags);
if (p_verbose > 0) { if (p_verbose > 0) {
/* Mention where the option was last set. */ // Mention where the option was last set.
if (varp == options[opt_idx].var) if (varp == options[opt_idx].var) {
option_last_set_msg(options[opt_idx].last_set); option_last_set_msg(options[opt_idx].last_set);
else if ((int)options[opt_idx].indir & PV_WIN) } else if ((int)options[opt_idx].indir & PV_WIN) {
option_last_set_msg(curwin->w_p_scriptID[ option_last_set_msg(curwin->w_p_scriptID[
(int)options[opt_idx].indir & PV_MASK]); (int)options[opt_idx].indir & PV_MASK]);
else if ((int)options[opt_idx].indir & PV_BUF) } else if ((int)options[opt_idx].indir & PV_BUF) {
option_last_set_msg(curbuf->b_p_scriptID[ option_last_set_msg(curbuf->b_p_scriptID[
(int)options[opt_idx].indir & PV_MASK]); (int)options[opt_idx].indir & PV_MASK]);
} }
}
} else { } else {
errmsg = (char_u *)N_("E846: Key code not set"); errmsg = (char_u *)N_("E846: Key code not set");
goto skip; goto skip;
@ -3665,8 +3666,8 @@ static void set_option_scriptID_idx(int opt_idx, int opt_flags, int id)
int indir = (int)options[opt_idx].indir; int indir = (int)options[opt_idx].indir;
const LastSet last_set = { id, current_channel_id }; const LastSet last_set = { id, current_channel_id };
/* Remember where the option was set. For local options need to do that // Remember where the option was set. For local options need to do that
* in the buffer or window structure. */ // in the buffer or window structure.
if (both || (opt_flags & OPT_GLOBAL) || (indir & (PV_BUF|PV_WIN)) == 0) { if (both || (opt_flags & OPT_GLOBAL) || (indir & (PV_BUF|PV_WIN)) == 0) {
options[opt_idx].last_set = last_set; options[opt_idx].last_set = last_set;
} }