diff options
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 41e0fced2c..1da259e6b8 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -187,16 +187,16 @@ static long p_tw_nopaste; static long p_wm_nopaste; typedef struct vimoption { - char *fullname; /* full option name */ - char *shortname; /* permissible abbreviation */ - uint32_t flags; /* see below */ - char_u *var; /* global option: pointer to variable; - * window-local option: VAR_WIN; - * buffer-local option: global value */ - idopt_T indir; /* global option: PV_NONE; - * local option: indirect option index */ - char_u *def_val[2]; /* default values for variable (vi and vim) */ - scid_T scriptID; /* script in which the option was last set */ + char *fullname; // full option name + char *shortname; // permissible abbreviation + uint32_t flags; // see below + char_u *var; // global option: pointer to variable; + // window-local option: VAR_WIN; + // buffer-local option: global value + idopt_T indir; // global option: PV_NONE; + // local option: indirect option index + char_u *def_val[2]; // default values for variable (vi and vim) + LastSet last_set; // script in which the option was last set # define SCRIPTID_INIT , 0 } vimoption_T; @@ -1345,15 +1345,16 @@ do_set ( if (opt_idx >= 0) { showoneopt(&options[opt_idx], opt_flags); if (p_verbose > 0) { - /* Mention where the option was last set. */ - if (varp == options[opt_idx].var) - last_set_msg(options[opt_idx].scriptID); - else if ((int)options[opt_idx].indir & PV_WIN) - last_set_msg(curwin->w_p_scriptID[ - (int)options[opt_idx].indir & PV_MASK]); - else if ((int)options[opt_idx].indir & PV_BUF) - last_set_msg(curbuf->b_p_scriptID[ - (int)options[opt_idx].indir & PV_MASK]); + // Mention where the option was last set. + if (varp == options[opt_idx].var) { + option_last_set_msg(options[opt_idx].last_set); + } else if ((int)options[opt_idx].indir & PV_WIN) { + option_last_set_msg(curwin->w_p_scriptID[ + (int)options[opt_idx].indir & PV_MASK]); + } else if ((int)options[opt_idx].indir & PV_BUF) { + option_last_set_msg(curbuf->b_p_scriptID[ + (int)options[opt_idx].indir & PV_MASK]); + } } } else { errmsg = (char_u *)N_("E846: Key code not set"); @@ -3642,16 +3643,19 @@ static void set_option_scriptID_idx(int opt_idx, int opt_flags, int id) { int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; int indir = (int)options[opt_idx].indir; + const LastSet last_set = { id, current_channel_id }; - /* Remember where the option was set. For local options need to do that - * in the buffer or window structure. */ - if (both || (opt_flags & OPT_GLOBAL) || (indir & (PV_BUF|PV_WIN)) == 0) - options[opt_idx].scriptID = id; + // Remember where the option was set. For local options need to do that + // in the buffer or window structure. + if (both || (opt_flags & OPT_GLOBAL) || (indir & (PV_BUF|PV_WIN)) == 0) { + options[opt_idx].last_set = last_set; + } if (both || (opt_flags & OPT_LOCAL)) { - if (indir & PV_BUF) - curbuf->b_p_scriptID[indir & PV_MASK] = id; - else if (indir & PV_WIN) - curwin->w_p_scriptID[indir & PV_MASK] = id; + if (indir & PV_BUF) { + curbuf->b_p_scriptID[indir & PV_MASK] = last_set; + } else if (indir & PV_WIN) { + curwin->w_p_scriptID[indir & PV_MASK] = last_set; + } } } |