aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorKyle <50718101+kylesower@users.noreply.github.com>2026-08-10 03:17:51 -0500
committerGitHub <noreply@github.com>2026-08-10 04:17:51 -0400
commit8d406ed2acac032d2d7ff560ec26c07d5e284c27 (patch)
tree565b8fac91d864dd4eb664aa46ca98cab5a2a16f /runtime/lua/vim
parent4b8c4dfc680fe0b6c6883ff0e641c1ee7f835711 (diff)
downloadrneovim-8d406ed2acac032d2d7ff560ec26c07d5e284c27.tar.gz
rneovim-8d406ed2acac032d2d7ff560ec26c07d5e284c27.tar.bz2
rneovim-8d406ed2acac032d2d7ff560ec26c07d5e284c27.zip
fix(defaults): emit events on automatic background change #41242
Problem: After #40270, events are no longer emitted from the automatic background detection. This applies not just during startup, but also if the user manually changes the background of their terminal. Solution: Set the background as normal, assuming that a normal terminal will respond within 100 ms. Change test to match expected behavior: - BG set during startup won't trigger user autocmds since it runs before any user config - If the terminal takes longer than 100 ms to respond to initial OSC 11, it does trigger the OptionSet, but it is triggered through the normal path to ensure values like v:option_new are set #38551 - BG change after startup still triggers autocmds #41146
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/_core/defaults.lua3
1 files changed, 1 insertions, 2 deletions
diff --git a/runtime/lua/vim/_core/defaults.lua b/runtime/lua/vim/_core/defaults.lua
index 4414608cbf..20b21c3082 100644
--- a/runtime/lua/vim/_core/defaults.lua
+++ b/runtime/lua/vim/_core/defaults.lua
@@ -964,8 +964,7 @@ do
if rr and gg and bb then
local luminance = (0.299 * rr) + (0.587 * gg) + (0.114 * bb)
local bg = luminance < 0.5 and 'dark' or 'light'
- -- Use :noautocmd to suppress OptionSet event; OSC11 response may arrive after VimEnter.
- vim.cmd('noautocmd set background=' .. bg)
+ vim.o.background = bg
end
end
end