diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-06-12 17:30:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 17:30:11 +0100 |
commit | 53afdf360cf195c02c22865f4e63b273d1ef152e (patch) | |
tree | 50db7498ca2d531dcd2803d133380f923f9d0c6a /runtime/lua/vim/_options.lua | |
parent | 9cac40ba1e1e973392e4db71d2855867b57ce850 (diff) | |
parent | 2ca678f57de1cb4332d39337ae1c5a63a1ff434a (diff) | |
download | rneovim-53afdf360cf195c02c22865f4e63b273d1ef152e.tar.gz rneovim-53afdf360cf195c02c22865f4e63b273d1ef152e.tar.bz2 rneovim-53afdf360cf195c02c22865f4e63b273d1ef152e.zip |
Merge pull request #29303 from lewis6991/fix/wobuf
fix(vim.wo): never allow non-zero bufnr
Diffstat (limited to 'runtime/lua/vim/_options.lua')
-rw-r--r-- | runtime/lua/vim/_options.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/runtime/lua/vim/_options.lua b/runtime/lua/vim/_options.lua index 4a360c18e4..a61fa61256 100644 --- a/runtime/lua/vim/_options.lua +++ b/runtime/lua/vim/_options.lua @@ -174,6 +174,11 @@ local function new_buf_opt_accessor(bufnr) end local function new_win_opt_accessor(winid, bufnr) + -- TODO(lewis6991): allow passing both buf and win to nvim_get_option_value + if bufnr ~= nil and bufnr ~= 0 then + error('only bufnr=0 is supported') + end + return setmetatable({}, { __index = function(_, k) if bufnr == nil and type(k) == 'number' then @@ -184,11 +189,6 @@ local function new_win_opt_accessor(winid, bufnr) end end - if bufnr ~= nil and bufnr ~= 0 then - error('only bufnr=0 is supported') - end - - -- TODO(lewis6991): allow passing both buf and win to nvim_get_option_value return api.nvim_get_option_value(k, { scope = bufnr and 'local' or nil, win = winid or 0, @@ -196,7 +196,6 @@ local function new_win_opt_accessor(winid, bufnr) end, __newindex = function(_, k, v) - -- TODO(lewis6991): allow passing both buf and win to nvim_set_option_value return api.nvim_set_option_value(k, v, { scope = bufnr and 'local' or nil, win = winid or 0, |