diff options
author | b-r-o-c-k <brockmammen@gmail.com> | 2018-04-29 21:02:17 -0500 |
---|---|---|
committer | b-r-o-c-k <brockmammen@gmail.com> | 2018-05-03 21:05:20 -0500 |
commit | 7170de19714acd5efa6979ef94de2a29e41d6173 (patch) | |
tree | aef99101c9b9926704fdc0ec59ee7102af26631e /src/nvim/option.c | |
parent | 4744142fad9209a1adaa190b9bf16ddcbcb67ca9 (diff) | |
download | rneovim-7170de19714acd5efa6979ef94de2a29e41d6173.tar.gz rneovim-7170de19714acd5efa6979ef94de2a29e41d6173.tar.bz2 rneovim-7170de19714acd5efa6979ef94de2a29e41d6173.zip |
api: Make nvim_set_option() update `:verbose set ...`
Make `:verbose set ...` show when an option was last modified by an
API client or Lua script/chunk. In the case of an API client, the
channel ID is displayed.
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 48fd797ee9..a2120b9ab4 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -196,7 +196,7 @@ typedef struct vimoption { 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 */ + LastSet last_set; /* script in which the option was last set */ # define SCRIPTID_INIT , 0 } vimoption_T; @@ -1368,12 +1368,12 @@ do_set ( if (p_verbose > 0) { /* Mention where the option was last set. */ if (varp == options[opt_idx].var) - last_set_msg(options[opt_idx].scriptID); + option_last_set_msg(options[opt_idx].last_set); else if ((int)options[opt_idx].indir & PV_WIN) - last_set_msg(curwin->w_p_scriptID[ + option_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[ + option_last_set_msg(curbuf->b_p_scriptID[ (int)options[opt_idx].indir & PV_MASK]); } } else { @@ -3663,16 +3663,18 @@ 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; + 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; + curbuf->b_p_scriptID[indir & PV_MASK] = last_set; else if (indir & PV_WIN) - curwin->w_p_scriptID[indir & PV_MASK] = id; + curwin->w_p_scriptID[indir & PV_MASK] = last_set; } } |