Skip to content

fix(main): prevent Neovim 0.12 TUI background autocmd removal on first colorscheme load#764

Open
guohao117 wants to merge 1 commit into
folke:mainfrom
guohao117:main
Open

fix(main): prevent Neovim 0.12 TUI background autocmd removal on first colorscheme load#764
guohao117 wants to merge 1 commit into
folke:mainfrom
guohao117:main

Conversation

@guohao117

@guohao117 guohao117 commented Mar 31, 2026

Copy link
Copy Markdown

Description

neovim/neovim@d460928#diff-49225a49c226c2f1b36f966d0178c556e204cdc0b660c80db9e4568e03f6ef99R689

In Neovim 0.12, when the terminal reports a light background, the initial colorscheme still explicitly set background=dark during setup. However, setting the background option at this stage triggers Neovim to remove its internal TermResponse AutoCommand, which is responsible for handling the CSI 2031 terminal response and automatic background switching.

As a result, Neovim loses the ability to automatically switch between dark and light backgrounds based on terminal feedback. This PR avoids setting the background option on the first colorscheme load, preserving Neovim's TermResponse AutoCommand and ensuring correct background detection and switching.

Related Issue(s)

Checklist

…m TUI CSI 2031 term response autocmd

neovim/neovim@d460928#diff-49225a49c226c2f1b36f966d0178c556e204cdc0b660c80db9e4568e03f6ef99R689
Neovim 0.12+ introduces TUI changes where setting 'background' during the first colorscheme load can remove the CSI 2031 term response autocmd, causing automatic background switching (dark/light) to stop working. This commit ensures 'background' is not set on initial load, preserving Neovim's background detection functionality.
@github-actions github-actions Bot added core size/xs Extra small PR (<3 lines changed) labels Mar 31, 2026
@guohao117 guohao117 changed the title fix: prevent Neovim 0.12 TUI background autocmd removal on first colorscheme load fix(main): prevent Neovim 0.12 TUI background autocmd removal on first colorscheme load Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core size/xs Extra small PR (<3 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant