fix(tui): don't set tty background if &bg was set before VimEnter (#23701)

This commit is contained in:
Null Chilly 2023-05-26 16:51:02 +07:00 committed by GitHub
parent 68da87d2e7
commit 5a08b5be3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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