commit c3e176f6e24e2b97603b59bb89b125d540e1274d
parent 6abc608445745e7e8def2aabf57c7a0c26b8a485
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue, 5 Sep 2023 20:03:25 +0800
fix(options): correct condition for calling did_set_option() (#25026)
Diffstat:
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/nvim/option.c b/src/nvim/option.c
@@ -3772,7 +3772,7 @@ static const char *set_option(int opt_idx, void *varp, OptVal *v, int opt_flags,
errbuf, errbuflen);
}
- if (errmsg != NULL) {
+ if (errmsg == NULL) {
did_set_option(opt_idx, opt_flags, true, value_checked);
}
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
@@ -1416,6 +1416,20 @@ describe('API', function()
eq(true, status)
eq(' equalalways\n\tLast set from Lua', rv)
end)
+
+ it('updates whether the option has ever been set #25025', function()
+ eq(false, nvim('get_option_info2', 'autochdir', {}).was_set)
+ nvim('set_option_value', 'autochdir', true, {})
+ eq(true, nvim('get_option_info2', 'autochdir', {}).was_set)
+
+ eq(false, nvim('get_option_info2', 'cmdwinheight', {}).was_set)
+ nvim('set_option_value', 'cmdwinheight', 10, {})
+ eq(true, nvim('get_option_info2', 'cmdwinheight', {}).was_set)
+
+ eq(false, nvim('get_option_info2', 'debug', {}).was_set)
+ nvim('set_option_value', 'debug', 'beep', {})
+ eq(true, nvim('get_option_info2', 'debug', {}).was_set)
+ end)
end)
describe('nvim_get_option_value, nvim_set_option_value', function()