fix(options): correct condition for calling did_set_option() (#25026)

This commit is contained in:
zeertzjq 2023-09-05 20:03:25 +08:00 committed by GitHub
parent 6abc608445
commit c3e176f6e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -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);
}

View File

@ -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()