mirror of
https://github.com/neovim/neovim.git
synced 2026-03-28 11:22:03 +00:00
Problem: Automatic background detection sets the background option too late, which loads colorschemes twice and causes problems when the user's terminal background doesn't match the default (#32109, #36211, #36416). Solution: Use a DA1 query to determine whether the TTY supports OSC 11. Wait for background detection and setting to complete before processing user config. Note: To preserve the existing behavior as much as possible, this triggers OptionSet manually on VimEnter (since it won't trigger automatically if we set bg during startup). However, I'm unsure if this behavior is truly desired given that the documentation says OptionSet is triggered "After setting an option (except during |startup|)." Also fixes flickering issue #28667. To check for flickering: nvim --clean --cmd "set termguicolors" --cmd "echo \"foo\"" --cmd "sleep 10" On master, this gives me a black screen for 10 seconds, but on this branch, the background is dark or light depending on the terminal background (since the option is now set during startup rather than after VimEnter).