mirror of
https://github.com/neovim/neovim.git
synced 2026-06-15 16:23:48 +00:00
@@ -482,6 +482,8 @@ These existing features changed their behavior.
|
||||
• |nvim_create_autocmd()|
|
||||
• |nvim_exec_autocmds()|
|
||||
• |nvim_get_autocmds()|
|
||||
• |OptionSet| is no longer triggered during startup by automatic
|
||||
|'background'| detection.
|
||||
|
||||
==============================================================================
|
||||
REMOVED FEATURES *news-removed*
|
||||
|
||||
@@ -850,7 +850,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
global
|
||||
When set to "dark" or "light", adjusts the default color groups for
|
||||
that background type. The |TUI| or other UI sets this on startup
|
||||
(triggering |OptionSet|) if it can detect the background color.
|
||||
if it can detect the background color.
|
||||
|
||||
This option does NOT change the background color, it tells Nvim what
|
||||
the "inherited" (terminal/GUI) background looks like.
|
||||
@@ -1466,7 +1466,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
|
||||
*'cmdheight'* *'ch'*
|
||||
'cmdheight' 'ch' number (default 1)
|
||||
global or local to tab page
|
||||
global or local to tabpage
|
||||
Number of screen lines to use for the command-line. Helps avoiding
|
||||
|hit-enter| prompts.
|
||||
The value of this option is stored with the tabpage, so that each
|
||||
|
||||
@@ -37,10 +37,10 @@ Each tabpage has an unique identifier which will not change, even after
|
||||
rearranging tabs. |nvim_get_current_tabpage()| returns the tab-id and
|
||||
|nvim_list_tabpages()| lists tab-ids in the order they're displayed.
|
||||
*tabpage-number*
|
||||
Tabpages are also numbered from left to right starting at 1: this is the tab
|
||||
"number" returned by |tabpagenr()|, not the tab-id. The tab number may change
|
||||
when tabs are opened, closed, or rearranged. |nvim_tabpage_get_number()|
|
||||
converts a tab-id to a tab number.
|
||||
Tabpages are numbered from left to right starting at 1: this tab "number" is
|
||||
returned by |tabpagenr()|. Unlike the tab-id, the tab number may change when
|
||||
tabs are opened, closed, or rearranged. |nvim_tabpage_get_number()| converts
|
||||
a tab-id to a tab number.
|
||||
|
||||
|
||||
==============================================================================
|
||||
|
||||
@@ -82,10 +82,10 @@ Each window has a unique identifier called the window ID, which is permanent
|
||||
during the Nvim session. The |win_getid()| and |win_id2tabwin()| functions
|
||||
convert between the window/tab "number" and the identifier.
|
||||
*window-number*
|
||||
Windows are also numbered according to their arrangement in a tabpage; this
|
||||
window "number" is given by |winnr()| and may change whenever windows are
|
||||
opened or closed. The window number is only valid in one specific tab, whereas
|
||||
the window ID is valid globally, across tabs. For most functions that take
|
||||
Windows are numbered according to their arrangement in a tabpage; this window
|
||||
"number" is given by |winnr()| and may change whenever windows are opened or
|
||||
closed. The window number is only valid in one specific tab, whereas the
|
||||
window ID is valid globally, across tabs. For most functions that take
|
||||
a window ID or a window number, the window number only applies to the current
|
||||
tab, while the window ID can refer to a window in any tab.
|
||||
|
||||
|
||||
@@ -940,20 +940,6 @@ do
|
||||
local luminance = (0.299 * rr) + (0.587 * gg) + (0.114 * bb)
|
||||
local bg = luminance < 0.5 and 'dark' or 'light'
|
||||
vim.api.nvim_set_option_value('background', bg, {})
|
||||
|
||||
-- Ensure OptionSet still triggers when we set the background during startup
|
||||
if vim.v.vim_did_enter == 0 then
|
||||
vim.api.nvim_create_autocmd('VimEnter', {
|
||||
group = group,
|
||||
once = true,
|
||||
nested = true,
|
||||
callback = function()
|
||||
vim.api.nvim_exec_autocmds('OptionSet', {
|
||||
pattern = 'background',
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
2
runtime/lua/vim/_meta/options.gen.lua
generated
2
runtime/lua/vim/_meta/options.gen.lua
generated
@@ -224,7 +224,7 @@ vim.go.awa = vim.go.autowriteall
|
||||
|
||||
--- When set to "dark" or "light", adjusts the default color groups for
|
||||
--- that background type. The `TUI` or other UI sets this on startup
|
||||
--- (triggering `OptionSet`) if it can detect the background color.
|
||||
--- if it can detect the background color.
|
||||
---
|
||||
--- This option does NOT change the background color, it tells Nvim what
|
||||
--- the "inherited" (terminal/GUI) background looks like.
|
||||
|
||||
@@ -645,7 +645,7 @@ local function option_scope_doc(o)
|
||||
global = 'global',
|
||||
buf = 'local to buffer',
|
||||
win = 'local to window',
|
||||
tab = 'local to tab page',
|
||||
tab = 'local to tabpage',
|
||||
}
|
||||
|
||||
local r --- @type string
|
||||
|
||||
@@ -4013,7 +4013,7 @@ void set_option_direct_for(OptIndex opt_idx, OptVal value, int opt_flags, scid_T
|
||||
curbuf = save_curbuf;
|
||||
}
|
||||
|
||||
/// Set the value of an option.
|
||||
/// Sets the value of an (non-tty) option.
|
||||
///
|
||||
/// @param opt_idx Index in options[] table. Must not be kOptInvalid.
|
||||
/// @param[in] value Option value. If NIL_OPTVAL, the option value is cleared.
|
||||
|
||||
@@ -366,7 +366,7 @@ local options = {
|
||||
desc = [=[
|
||||
When set to "dark" or "light", adjusts the default color groups for
|
||||
that background type. The |TUI| or other UI sets this on startup
|
||||
(triggering |OptionSet|) if it can detect the background color.
|
||||
if it can detect the background color.
|
||||
|
||||
This option does NOT change the background color, it tells Nvim what
|
||||
the "inherited" (terminal/GUI) background looks like.
|
||||
|
||||
@@ -4282,23 +4282,28 @@ describe('TUI bg color', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
it('triggers OptionSet from automatic background processing', function()
|
||||
it('does not trigger OptionSet from automatic background processing', function()
|
||||
command('set background=light')
|
||||
local child_server = new_pipename()
|
||||
local screen = tt.setup_child_nvim({
|
||||
'--clean',
|
||||
'--listen',
|
||||
child_server,
|
||||
'--cmd',
|
||||
'colorscheme vim',
|
||||
'--cmd',
|
||||
'set noswapfile',
|
||||
'-c',
|
||||
'autocmd OptionSet background echo "did OptionSet, yay!"',
|
||||
[[let g:background_optionset = 0]],
|
||||
'-c',
|
||||
[[autocmd OptionSet background let g:background_optionset += 1]],
|
||||
})
|
||||
screen:expect([[
|
||||
^ |
|
||||
{5:~} |*3
|
||||
{3:[No Name] 0,0-1 All}|
|
||||
did OptionSet, yay! |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
screen:expect({ any = '%[No Name%]' })
|
||||
local child_session = n.connect(child_server)
|
||||
retry(nil, nil, function()
|
||||
eq({ true, 'light' }, { child_session:request('nvim_eval', '&background') })
|
||||
end)
|
||||
eq({ true, 0 }, { child_session:request('nvim_eval', 'g:background_optionset') })
|
||||
end)
|
||||
|
||||
it('sends theme update notifications when background changes #31652', function()
|
||||
|
||||
Reference in New Issue
Block a user