diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-05-11 10:08:09 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-05-11 10:08:09 +0200 |
commit | 273d2cd5d5cfc7616c76d3531e9938750abcc05e (patch) | |
tree | 0783f4e14c18bd0af586f83842e8a238eb1c1e1a /src/nvim/eval.c | |
parent | 8d40b3617c8bb10af5d4d4abcab0dfe77a4e807d (diff) | |
parent | e31d8ed36a78706cdaa6307cb37ea6a102c5e2f7 (diff) | |
download | rneovim-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/eval.c')
-rw-r--r-- | src/nvim/eval.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 45a1776c86..126e9e0da9 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -22066,12 +22066,27 @@ 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)); + const LastSet last_set = (LastSet){ + .script_id = scriptID, + .channel_id = 0, + }; + 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(); } } |