fix(tui): use nvim_get_option_info2 instead of &bg

This commit is contained in:
Null Chilly
2023-05-23 16:09:04 +07:00
parent 7d1b3c2b46
commit a60cfebdb9

View File

@@ -3336,8 +3336,8 @@ void set_tty_background(const char *value)
if (starting) { if (starting) {
// Wait until after startup, so OptionSet is triggered. // Wait until after startup, so OptionSet is triggered.
do_cmdline_cmd((value[0] == 'l') do_cmdline_cmd((value[0] == 'l')
? "autocmd VimEnter * ++once ++nested if &bg == '' | set bg=light | endif" ? "autocmd VimEnter * ++once ++nested :lua if not vim.api.nvim_get_option_info2('bg', {}).was_set then vim.o.bg = 'light' end"
: "autocmd VimEnter * ++once ++nested if &bg == '' | set bg=dark | endif"); : "autocmd VimEnter * ++once ++nested :lua if not vim.api.nvim_get_option_info2('bg', {}).was_set then vim.o.bg = 'dark' end");
} else { } else {
set_option_value_give_err("bg", 0L, value, 0); set_option_value_give_err("bg", 0L, value, 0);
reset_option_was_set("bg"); reset_option_was_set("bg");