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/eval.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/eval.c')
-rw-r--r-- | src/nvim/eval.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index cc29496968..c48c22fd96 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -22061,12 +22061,25 @@ int store_session_globals(FILE *fd) */ void last_set_msg(scid_T scriptID) { - if (scriptID != 0) { - char_u *p = home_replace_save(NULL, get_scriptname(scriptID)); + LastSet last_set; + last_set.script_id = scriptID; + option_last_set_msg(last_set); +} + +/// Displays where an option was last set. +/// +/// Should only be invoked when 'verbose' is non-zero. +void option_last_set_msg(LastSet last_set) +{ + if (last_set.script_id != 0) { + bool should_free; + char_u *p = get_scriptname(last_set, &should_free); verbose_enter(); MSG_PUTS(_("\n\tLast set from ")); MSG_PUTS(p); - xfree(p); + if (should_free) { + xfree(p); + } verbose_leave(); } } |