aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-05-11 10:08:09 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-05-11 10:08:09 +0200
commit273d2cd5d5cfc7616c76d3531e9938750abcc05e (patch)
tree0783f4e14c18bd0af586f83842e8a238eb1c1e1a /src/nvim/option.c
parent8d40b3617c8bb10af5d4d4abcab0dfe77a4e807d (diff)
parente31d8ed36a78706cdaa6307cb37ea6a102c5e2f7 (diff)
downloadrneovim-273d2cd5d5cfc7616c76d3531e9938750abcc05e.tar.gz
rneovim-273d2cd5d5cfc7616c76d3531e9938750abcc05e.tar.bz2
rneovim-273d2cd5d5cfc7616c76d3531e9938750abcc05e.zip
Merge #8329 'API: Make nvim_set_option() update `:verbose set …`'
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c58
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;
+ }
}
}