feat(tui): update 'background' on theme change events (#31350)

Enabling private DEC mode 2031 tells the terminal to notify Nvim
whenever the OS theme changes (i.e. light mode to dark mode or vice
versa) or the terminal emulator's palette changes. When we receive one
of these notifications we query the terminal color's background color
again to see if it has changed and update the value of 'background' if
it has.

We only do this though if the user has not explicitly set the value of
'bg' themselves. The help text is updated slightly to hint to users that
they probably shouldn't set this value: on modern terminal emulators
Nvim is able to completely determine this automatically.
This commit is contained in:
Gregory Anders
2024-11-26 14:22:01 -06:00
committed by GitHub
parent 99b5ffd688
commit d460928263
6 changed files with 101 additions and 28 deletions

View File

@@ -284,6 +284,8 @@ TUI
:lua =vim.api.nvim_get_chan_info(vim.api.nvim_list_uis()[1].chan)
• |log| messages written by the builtin UI client (TUI, |--remote-ui|) are
now prefixed with "ui" instead of "?".
• The TUI will re-query the terminal's background color when a theme update
notification is received and Nvim will update 'background' accordingly.
UI