mirror of
https://github.com/neovim/neovim.git
synced 2026-09-09 07:25:51 +00:00
fix(optwin): handle tabpage local options
This commit is contained in:
@@ -463,8 +463,10 @@ local options_list = {
|
||||
|
||||
local local_to_window = N_ '(local to window)'
|
||||
local local_to_buffer = N_ '(local to buffer)'
|
||||
local local_to_tabpage = N_ '(local to tabpage)'
|
||||
local global_or_local_to_buffer = N_ '(global or local to buffer)'
|
||||
local global_or_local_to_window = N_ '(global or local to window)'
|
||||
local global_or_local_to_tabpage = N_ '(global or local to tabpage)'
|
||||
|
||||
local lines = {
|
||||
N_ '" Each "set" line shows the current value of an option (on the left).',
|
||||
@@ -503,10 +505,16 @@ for header_number, options in ipairs(options_list) do
|
||||
table.insert(lines, '\t' .. global_or_local_to_buffer)
|
||||
elseif info.scope == 'win' and info.global_local then
|
||||
table.insert(lines, '\t' .. global_or_local_to_window)
|
||||
elseif info.scope == 'tab' and info.global_local then
|
||||
table.insert(lines, '\t' .. global_or_local_to_tabpage)
|
||||
elseif info.scope == 'buf' then
|
||||
table.insert(lines, '\t' .. local_to_buffer)
|
||||
elseif info.scope == 'win' then
|
||||
table.insert(lines, '\t' .. local_to_window)
|
||||
elseif info.scope == 'tab' then
|
||||
table.insert(lines, '\t' .. local_to_tabpage)
|
||||
else
|
||||
assert(info.scope == 'global')
|
||||
end
|
||||
|
||||
local shortname = info.shortname or name
|
||||
@@ -592,7 +600,7 @@ local function update_current_line()
|
||||
|
||||
---@type any
|
||||
local value
|
||||
if info.global_local or info.scope == 'global' then
|
||||
if info.global_local or info.scope == 'global' or info.scope == 'tab' then
|
||||
value = vim.o[name] --[[@as any]]
|
||||
else
|
||||
local win = find_window_to_have_options_in()
|
||||
@@ -642,7 +650,7 @@ local function current_line_set_option()
|
||||
value = assert(tonumber(value), value .. ' is not a number')
|
||||
end
|
||||
|
||||
if info.global_local or info.scope == 'global' then
|
||||
if info.global_local or info.scope == 'global' or info.scope == 'tab' then
|
||||
---@diagnostic disable-next-line: no-unknown
|
||||
vim.o[name] = value
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user