From 576dddb46168e81aa0f78c28816082c662dedea1 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Mon, 22 May 2023 12:47:10 +0600 Subject: [PATCH] test: don't unnecessarily specify win/buf for `nvim_(get|set)_option_value` `nvim_(get|set)_option_value` pick the current buffer / window by default for buffer-local/window-local (but not global-local) options. So specifying `buf = 0` or `win = 0` in opts is unnecessary for those options. This PR removes those to reduce code clutter. --- test/functional/api/buffer_spec.lua | 14 +++---- test/functional/api/extmark_spec.lua | 4 +- test/functional/api/vim_spec.lua | 4 +- test/functional/api/window_spec.lua | 6 +-- test/functional/ex_cmds/append_spec.lua | 2 +- test/functional/ex_cmds/mksession_spec.lua | 6 +-- test/functional/legacy/012_directory_spec.lua | 4 +- test/functional/lua/buffer_updates_spec.lua | 8 ++-- test/functional/lua/filetype_spec.lua | 2 +- test/functional/lua/luaeval_spec.lua | 2 +- test/functional/lua/secure_spec.lua | 2 +- test/functional/lua/vim_spec.lua | 6 +-- .../plugin/lsp/incremental_sync_spec.lua | 2 +- test/functional/plugin/shada_spec.lua | 30 +++++++-------- test/functional/provider/perl_spec.lua | 2 +- test/functional/provider/ruby_spec.lua | 2 +- test/functional/shada/buffers_spec.lua | 4 +- test/functional/terminal/scrollback_spec.lua | 38 +++++++++---------- test/functional/terminal/tui_spec.lua | 4 +- .../terminal/window_split_tab_spec.lua | 2 +- test/functional/ui/decorations_spec.lua | 6 +-- .../vimscript/buf_functions_spec.lua | 2 +- 22 files changed, 76 insertions(+), 76 deletions(-) diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua index df9092fa14..bf9e952319 100644 --- a/test/functional/api/buffer_spec.lua +++ b/test/functional/api/buffer_spec.lua @@ -630,19 +630,19 @@ describe('api/buf', function() eq('Index out of bounds', pcall_err(get_offset, 6)) eq('Index out of bounds', pcall_err(get_offset, -1)) - meths.set_option_value('eol', false, {buf=0}) - meths.set_option_value('fixeol', false, {buf=0}) + meths.set_option_value('eol', false, {}) + meths.set_option_value('fixeol', false, {}) eq(28, get_offset(5)) -- fileformat is ignored - meths.set_option_value('fileformat', 'dos', {buf=0}) + meths.set_option_value('fileformat', 'dos', {}) eq(0, get_offset(0)) eq(6, get_offset(1)) eq(15, get_offset(2)) eq(16, get_offset(3)) eq(24, get_offset(4)) eq(28, get_offset(5)) - meths.set_option_value('eol', true, {buf=0}) + meths.set_option_value('eol', true, {}) eq(29, get_offset(5)) command("set hidden") @@ -699,9 +699,9 @@ describe('api/buf', function() describe('nvim_get_option_value, nvim_set_option_value', function() it('works', function() - eq(8, nvim('get_option_value', 'shiftwidth', {buf = 0})) - nvim('set_option_value', 'shiftwidth', 4, {buf=0}) - eq(4, nvim('get_option_value', 'shiftwidth', {buf = 0})) + eq(8, nvim('get_option_value', 'shiftwidth', {})) + nvim('set_option_value', 'shiftwidth', 4, {}) + eq(4, nvim('get_option_value', 'shiftwidth', {})) -- global-local option nvim('set_option_value', 'define', 'test', {buf = 0}) eq('test', nvim('get_option_value', 'define', {buf = 0})) diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua index 0960e910f1..675c8332de 100644 --- a/test/functional/api/extmark_spec.lua +++ b/test/functional/api/extmark_spec.lua @@ -1401,7 +1401,7 @@ describe('API/extmarks', function() it('in read-only buffer', function() command("view! runtime/doc/help.txt") - eq(true, meths.get_option_value('ro', {buf=0})) + eq(true, meths.get_option_value('ro', {})) local id = set_extmark(ns, 0, 0, 2) eq({{id, 0, 2}}, get_extmarks(ns,0, -1)) end) @@ -1474,7 +1474,7 @@ describe('API/extmarks', function() it('in prompt buffer', function() feed('dd') local id = set_extmark(ns, marks[1], 0, 0, {}) - meths.set_option_value('buftype', 'prompt', {buf = 0}) + meths.set_option_value('buftype', 'prompt', {}) feed('i') eq({{id, 0, 2}}, get_extmarks(ns, 0, -1)) end) diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 5b8b52a559..040c26e058 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -1397,7 +1397,7 @@ describe('API', function() it('works to set global value of local options', function() nvim('set_option_value', 'lisp', true, {scope='global'}) eq(true, nvim('get_option_value', 'lisp', {scope='global'})) - eq(false, nvim('get_option_value', 'lisp', {buf=0})) + eq(false, nvim('get_option_value', 'lisp', {})) eq(nil, nvim('command_output', 'setglobal lisp?'):match('nolisp')) eq('nolisp', nvim('command_output', 'setlocal lisp?'):match('nolisp')) nvim('set_option_value', 'shiftwidth', 20, {scope='global'}) @@ -1493,7 +1493,7 @@ describe('API', function() end) it('set window options', function() - nvim('set_option_value', 'colorcolumn', '4,3', {win=0}) + nvim('set_option_value', 'colorcolumn', '4,3', {}) eq('4,3', nvim('get_option_value', 'colorcolumn', {scope = 'local'})) command("set modified hidden") command("enew") -- edit new buffer, window option is preserved diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 660fa4731e..a6d1807961 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -365,11 +365,11 @@ describe('API/win', function() describe('nvim_get_option_value, nvim_set_option_value', function() it('works', function() - nvim('set_option_value', 'colorcolumn', '4,3', {win=0}) - eq('4,3', nvim('get_option_value', 'colorcolumn', {win = 0})) + nvim('set_option_value', 'colorcolumn', '4,3', {}) + eq('4,3', nvim('get_option_value', 'colorcolumn', {})) command("set modified hidden") command("enew") -- edit new buffer, window option is preserved - eq('4,3', nvim('get_option_value', 'colorcolumn', {win = 0})) + eq('4,3', nvim('get_option_value', 'colorcolumn', {})) -- global-local option nvim('set_option_value', 'statusline', 'window-status', {win=0}) diff --git a/test/functional/ex_cmds/append_spec.lua b/test/functional/ex_cmds/append_spec.lua index e3a39384a6..4134eed87e 100644 --- a/test/functional/ex_cmds/append_spec.lua +++ b/test/functional/ex_cmds/append_spec.lua @@ -43,7 +43,7 @@ local cmdtest = function(cmd, prep, ret1) eq(hisline, funcs.histget(':', -2)) eq(cmd, funcs.histget(':')) -- Test that command-line window was launched - eq('nofile', meths.get_option_value('buftype', {buf=0})) + eq('nofile', meths.get_option_value('buftype', {})) eq('n', funcs.mode(1)) feed('') eq('c', funcs.mode(1)) diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua index f51e7c62cb..7522d4a99c 100644 --- a/test/functional/ex_cmds/mksession_spec.lua +++ b/test/functional/ex_cmds/mksession_spec.lua @@ -81,7 +81,7 @@ describe(':mksession', function() local buf_count = #meths.list_bufs() eq(2, buf_count) - eq('terminal', meths.get_option_value('buftype', { buf = 0 })) + eq('terminal', meths.get_option_value('buftype', {})) test_terminal_session_disabled(2) @@ -112,7 +112,7 @@ describe(':mksession', function() it('do not restore :terminal if not set in sessionoptions, only buffer #13078', function() command('terminal') - eq('terminal', meths.get_option_value('buftype', { buf = 0 })) + eq('terminal', meths.get_option_value('buftype', {})) local buf_count = #meths.list_bufs() eq(1, buf_count) @@ -120,7 +120,7 @@ describe(':mksession', function() test_terminal_session_disabled(1) -- no terminal should be set - eq('', meths.get_option_value('buftype', { buf = 0 })) + eq('', meths.get_option_value('buftype', {})) end) it('restores tab-local working directories', function() diff --git a/test/functional/legacy/012_directory_spec.lua b/test/functional/legacy/012_directory_spec.lua index f44ba10f7f..25d0dcb81e 100644 --- a/test/functional/legacy/012_directory_spec.lua +++ b/test/functional/legacy/012_directory_spec.lua @@ -58,7 +58,7 @@ describe("'directory' option", function() end of testfile]]) meths.set_option_value('swapfile', true, {}) - meths.set_option_value('swapfile', true, {buf=0}) + meths.set_option_value('swapfile', true, {}) meths.set_option_value('directory', '.', {}) -- sanity check: files should not exist yet. @@ -83,7 +83,7 @@ describe("'directory' option", function() meths.set_option_value('directory', 'Xtest.je', {}) command('bdelete') command('edit Xtest2/Xtest3') - eq(true, meths.get_option_value('swapfile', {buf=0})) + eq(true, meths.get_option_value('swapfile', {})) poke_eventloop() eq({ "Xtest3" }, ls_dir_sorted("Xtest2")) diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index 64cb524e99..d415b708be 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -415,7 +415,7 @@ describe('lua: nvim_buf_attach on_bytes', function() it('opening lines', function() local check_events = setup_eventcheck(verify, origlines) - -- meths.set_option_value('autoindent', true, { buf = 0 }) + -- meths.set_option_value('autoindent', true, {}) feed 'Go' check_events { { "test1", "bytes", 1, 4, 7, 0, 114, 0, 0, 0, 1, 0, 1 }; @@ -428,7 +428,7 @@ describe('lua: nvim_buf_attach on_bytes', function() it('opening lines with autoindent', function() local check_events = setup_eventcheck(verify, origlines) - meths.set_option_value('autoindent', true, { buf = 0 }) + meths.set_option_value('autoindent', true, {}) feed 'Go' check_events { { "test1", "bytes", 1, 4, 7, 0, 114, 0, 0, 0, 1, 0, 5 }; @@ -462,8 +462,8 @@ describe('lua: nvim_buf_attach on_bytes', function() it('continuing comments with fo=or', function() local check_events = setup_eventcheck(verify, {'// Comment'}) - meths.set_option_value('formatoptions', 'ro', { buf = 0 }) - meths.set_option_value('filetype', 'c', { buf = 0 }) + meths.set_option_value('formatoptions', 'ro', {}) + meths.set_option_value('filetype', 'c', {}) feed 'A' check_events { { "test1", "bytes", 1, 4, 0, 10, 10, 0, 0, 0, 1, 3, 4 }; diff --git a/test/functional/lua/filetype_spec.lua b/test/functional/lua/filetype_spec.lua index 4ea94796bc..b3d95e1c7f 100644 --- a/test/functional/lua/filetype_spec.lua +++ b/test/functional/lua/filetype_spec.lua @@ -134,6 +134,6 @@ end) describe('filetype.lua', function() it('does not override user autocommands that set filetype #20333', function() clear({args={'--clean', '--cmd', 'autocmd BufRead *.md set filetype=notmarkdown', 'README.md'}}) - eq('notmarkdown', meths.get_option_value('filetype', { buf = 0 })) + eq('notmarkdown', meths.get_option_value('filetype', {})) end) end) diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua index 31da5db1df..dfbd2fb18b 100644 --- a/test/functional/lua/luaeval_spec.lua +++ b/test/functional/lua/luaeval_spec.lua @@ -514,7 +514,7 @@ describe('v:lua', function() [5] = {bold = true, foreground = Screen.colors.SeaGreen4}, }) screen:attach() - meths.set_option_value('omnifunc', 'v:lua.mymod.omni', { buf = 0 }) + meths.set_option_value('omnifunc', 'v:lua.mymod.omni', {}) feed('isome st') screen:expect{grid=[[ some stuff^ | diff --git a/test/functional/lua/secure_spec.lua b/test/functional/lua/secure_spec.lua index 9a6292a6c6..fc20a06390 100644 --- a/test/functional/lua/secure_spec.lua +++ b/test/functional/lua/secure_spec.lua @@ -160,7 +160,7 @@ describe('vim.secure', function() -- Cannot write file pcall_err(command, 'write') - eq(true, meths.get_option_value('readonly', {buf=0})) + eq(true, meths.get_option_value('readonly', {})) end) end) diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 9a7654d610..978a4fe0b6 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -1496,7 +1496,7 @@ describe('lua stdlib', function() it('vim.bo', function() eq('', funcs.luaeval "vim.bo.filetype") exec_lua [[ - vim.api.nvim_set_option_value("filetype", "markdown", {buf = 0}) + vim.api.nvim_set_option_value("filetype", "markdown", {}) BUF = vim.api.nvim_create_buf(false, true) vim.api.nvim_set_option_value("modifiable", false, {buf = BUF}) ]] @@ -1519,9 +1519,9 @@ describe('lua stdlib', function() it('vim.wo', function() exec_lua [[ - vim.api.nvim_set_option_value("cole", 2, {win=0}) + vim.api.nvim_set_option_value("cole", 2, {}) vim.cmd "split" - vim.api.nvim_set_option_value("cole", 2, {win=0}) + vim.api.nvim_set_option_value("cole", 2, {}) ]] eq(2, funcs.luaeval "vim.wo.cole") exec_lua [[ diff --git a/test/functional/plugin/lsp/incremental_sync_spec.lua b/test/functional/plugin/lsp/incremental_sync_spec.lua index 1dca464d74..724b3efb97 100644 --- a/test/functional/plugin/lsp/incremental_sync_spec.lua +++ b/test/functional/plugin/lsp/incremental_sync_spec.lua @@ -21,7 +21,7 @@ before_each(function () -- ["mac"] = '\r', -- } - -- local line_ending = format_line_ending[vim.api.nvim_get_option_value('fileformat', {buf=0})] + -- local line_ending = format_line_ending[vim.api.nvim_get_option_value('fileformat', {})] function test_register(bufnr, id, offset_encoding, line_ending) diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index 43222f1904..8d37100607 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -2181,8 +2181,8 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "a"', }, nvim_eval('getline(1, "$")')) - eq(false, nvim('get_option_value', 'modified', {buf=0})) - eq('shada', nvim('get_option_value', 'filetype', {buf=0})) + eq(false, nvim('get_option_value', 'modified', {})) + eq('shada', nvim('get_option_value', 'filetype', {})) nvim_command('edit ' .. fname_tmp) eq({ 'History entry with timestamp ' .. epoch .. ':', @@ -2191,8 +2191,8 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "b"', }, nvim_eval('getline(1, "$")')) - eq(false, nvim('get_option_value', 'modified', {buf=0})) - eq('shada', nvim('get_option_value', 'filetype', {buf=0})) + eq(false, nvim('get_option_value', 'modified', {})) + eq('shada', nvim('get_option_value', 'filetype', {})) eq('++opt not supported', exc_exec('edit ++enc=latin1 ' .. fname)) neq({ 'History entry with timestamp ' .. epoch .. ':', @@ -2201,7 +2201,7 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "a"', }, nvim_eval('getline(1, "$")')) - neq(true, nvim('get_option_value', 'modified', {buf=0})) + neq(true, nvim('get_option_value', 'modified', {})) end) it('event FileReadCmd', function() @@ -2217,8 +2217,8 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "a"', }, nvim_eval('getline(1, "$")')) - eq(true, nvim('get_option_value', 'modified', {buf=0})) - neq('shada', nvim('get_option_value', 'filetype', {buf=0})) + eq(true, nvim('get_option_value', 'modified', {})) + neq('shada', nvim('get_option_value', 'filetype', {})) nvim_command('1,$read ' .. fname_tmp) eq({ '', @@ -2233,9 +2233,9 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "b"', }, nvim_eval('getline(1, "$")')) - eq(true, nvim('get_option_value', 'modified', {buf=0})) - neq('shada', nvim('get_option_value', 'filetype', {buf=0})) - nvim('set_option_value', 'modified', false, {buf=0}) + eq(true, nvim('get_option_value', 'modified', {})) + neq('shada', nvim('get_option_value', 'filetype', {})) + nvim('set_option_value', 'modified', false, {}) eq('++opt not supported', exc_exec('$read ++enc=latin1 ' .. fname)) eq({ '', @@ -2250,7 +2250,7 @@ describe('plugin/shada.vim', function() ' - contents "ab"', ' - "b"', }, nvim_eval('getline(1, "$")')) - neq(true, nvim('get_option_value', 'modified', {buf=0})) + neq(true, nvim('get_option_value', 'modified', {})) end) it('event BufWriteCmd', function() @@ -2517,10 +2517,10 @@ describe('ftplugin/shada.vim', function() it('sets options correctly', function() nvim_command('filetype plugin indent on') nvim_command('setlocal filetype=shada') - eq(true, nvim('get_option_value', 'expandtab', {buf=0})) - eq(2, nvim('get_option_value', 'tabstop', {buf=0})) - eq(2, nvim('get_option_value', 'softtabstop', {buf=0})) - eq(2, nvim('get_option_value', 'shiftwidth', {buf=0})) + eq(true, nvim('get_option_value', 'expandtab', {})) + eq(2, nvim('get_option_value', 'tabstop', {})) + eq(2, nvim('get_option_value', 'softtabstop', {})) + eq(2, nvim('get_option_value', 'shiftwidth', {})) end) it('sets indentkeys correctly', function() diff --git a/test/functional/provider/perl_spec.lua b/test/functional/provider/perl_spec.lua index bc7261895d..8049f0f3e2 100644 --- a/test/functional/provider/perl_spec.lua +++ b/test/functional/provider/perl_spec.lua @@ -45,7 +45,7 @@ describe('legacy perl provider', function() -- :perldo 1; doesn't change $_, -- the buffer should not be changed command('normal :perldo 1;') - eq(false, meths.get_option_value('modified', {buf=0})) + eq(false, meths.get_option_value('modified', {})) -- insert some text insert('abc\ndef\nghi') expect([[ diff --git a/test/functional/provider/ruby_spec.lua b/test/functional/provider/ruby_spec.lua index 40ace28c4e..d3b967dfbe 100644 --- a/test/functional/provider/ruby_spec.lua +++ b/test/functional/provider/ruby_spec.lua @@ -97,7 +97,7 @@ describe(':rubydo command', function() it('does not modify the buffer if no changes are made', function() command('normal :rubydo 42') - eq(false, meths.get_option_value('modified', {buf=0})) + eq(false, meths.get_option_value('modified', {})) end) end) diff --git a/test/functional/shada/buffers_spec.lua b/test/functional/shada/buffers_spec.lua index 2740eeeca6..b1c4ded541 100644 --- a/test/functional/shada/buffers_spec.lua +++ b/test/functional/shada/buffers_spec.lua @@ -48,7 +48,7 @@ describe('shada support code', function() reset('set shada+=%') nvim_command('edit ' .. testfilename) nvim_command('edit ' .. testfilename_2) - meths.set_option_value('buflisted', false, {buf=0}) + meths.set_option_value('buflisted', false, {}) expect_exit(nvim_command, 'qall') reset('set shada+=%') eq(2, funcs.bufnr('$')) @@ -60,7 +60,7 @@ describe('shada support code', function() reset('set shada+=%') nvim_command('edit ' .. testfilename) nvim_command('edit ' .. testfilename_2) - meths.set_option_value('buftype', 'quickfix', {buf=0}) + meths.set_option_value('buftype', 'quickfix', {}) expect_exit(nvim_command, 'qall') reset('set shada+=%') eq(2, funcs.bufnr('$')) diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua index 48a9fa7171..5d3e55d898 100644 --- a/test/functional/terminal/scrollback_spec.lua +++ b/test/functional/terminal/scrollback_spec.lua @@ -401,7 +401,7 @@ describe("'scrollback' option", function() screen = thelpers.screen_setup(nil, "['sh']", 30) end - meths.set_option_value('scrollback', 0, {buf = 0}) + meths.set_option_value('scrollback', 0, {}) feed_data(('%s REP 31 line%s'):format(testprg('shell-test'), is_os('win') and '\r' or '\n')) screen:expect{any='30: line '} retry(nil, nil, function() expect_lines(7) end) @@ -417,7 +417,7 @@ describe("'scrollback' option", function() screen = thelpers.screen_setup(nil, "['sh']", 30) end - meths.set_option_value('scrollback', 200, {buf=0}) + meths.set_option_value('scrollback', 200, {}) -- Wait for prompt. screen:expect{any='%$'} @@ -426,10 +426,10 @@ describe("'scrollback' option", function() screen:expect{any='30: line '} retry(nil, nil, function() expect_lines(33, 2) end) - meths.set_option_value('scrollback', 10, {buf=0}) + meths.set_option_value('scrollback', 10, {}) poke_eventloop() retry(nil, nil, function() expect_lines(16) end) - meths.set_option_value('scrollback', 10000, {buf=0}) + meths.set_option_value('scrollback', 10000, {}) retry(nil, nil, function() expect_lines(16) end) -- Terminal job data is received asynchronously, may happen before the -- 'scrollback' option is synchronized with the internal sb_buffer. @@ -484,18 +484,18 @@ describe("'scrollback' option", function() ]]) local term_height = 6 -- Actual terminal screen height, not the scrollback -- Initial - local scrollback = meths.get_option_value('scrollback', {buf=0}) + local scrollback = meths.get_option_value('scrollback', {}) eq(scrollback + term_height, eval('line("$")')) -- Reduction scrollback = scrollback - 2 - meths.set_option_value('scrollback', scrollback, {buf=0}) + meths.set_option_value('scrollback', scrollback, {}) eq(scrollback + term_height, eval('line("$")')) end) it('defaults to 10000 in :terminal buffers', function() set_fake_shell() command('terminal') - eq(10000, meths.get_option_value('scrollback', {buf=0})) + eq(10000, meths.get_option_value('scrollback', {})) end) it('error if set to invalid value', function() @@ -507,7 +507,7 @@ describe("'scrollback' option", function() it('defaults to -1 on normal buffers', function() command('new') - eq(-1, meths.get_option_value('scrollback', {buf=0})) + eq(-1, meths.get_option_value('scrollback', {})) end) it(':setlocal in a :terminal buffer', function() @@ -516,45 +516,45 @@ describe("'scrollback' option", function() -- _Global_ scrollback=-1 defaults :terminal to 10_000. command('setglobal scrollback=-1') command('terminal') - eq(10000, meths.get_option_value('scrollback', {buf=0})) + eq(10000, meths.get_option_value('scrollback', {})) -- _Local_ scrollback=-1 in :terminal forces the _maximum_. command('setlocal scrollback=-1') retry(nil, nil, function() -- Fixup happens on refresh, not immediately. - eq(100000, meths.get_option_value('scrollback', {buf=0})) + eq(100000, meths.get_option_value('scrollback', {})) end) -- _Local_ scrollback=-1 during TermOpen forces the maximum. #9605 command('setglobal scrollback=-1') command('autocmd TermOpen * setlocal scrollback=-1') command('terminal') - eq(100000, meths.get_option_value('scrollback', {buf=0})) + eq(100000, meths.get_option_value('scrollback', {})) end) it(':setlocal in a normal buffer', function() command('new') -- :setlocal to -1. command('setlocal scrollback=-1') - eq(-1, meths.get_option_value('scrollback', {buf=0})) + eq(-1, meths.get_option_value('scrollback', {})) -- :setlocal to anything except -1. Currently, this just has no effect. command('setlocal scrollback=42') - eq(42, meths.get_option_value('scrollback', {buf=0})) + eq(42, meths.get_option_value('scrollback', {})) end) it(':set updates local value and global default', function() set_fake_shell() command('set scrollback=42') -- set global value - eq(42, meths.get_option_value('scrollback', {buf=0})) + eq(42, meths.get_option_value('scrollback', {})) command('terminal') - eq(42, meths.get_option_value('scrollback', {buf=0})) -- inherits global default + eq(42, meths.get_option_value('scrollback', {})) -- inherits global default command('setlocal scrollback=99') - eq(99, meths.get_option_value('scrollback', {buf=0})) + eq(99, meths.get_option_value('scrollback', {})) command('set scrollback<') -- reset to global default - eq(42, meths.get_option_value('scrollback', {buf=0})) + eq(42, meths.get_option_value('scrollback', {})) command('setglobal scrollback=734') -- new global default - eq(42, meths.get_option_value('scrollback', {buf=0})) -- local value did not change + eq(42, meths.get_option_value('scrollback', {})) -- local value did not change command('terminal') - eq(734, meths.get_option_value('scrollback', {buf=0})) + eq(734, meths.get_option_value('scrollback', {})) end) end) diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 3cfd222336..1b65c1cddc 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -1458,8 +1458,8 @@ describe('TUI', function() it('allows grid to assume wider ambiguous-width characters than host terminal #19686', function() child_session:request('nvim_buf_set_lines', 0, 0, -1, true, { ('℃'):rep(60), ('℃'):rep(60) }) - child_session:request('nvim_set_option_value', 'cursorline', true, {win=0}) - child_session:request('nvim_set_option_value', 'list', true, {win=0}) + child_session:request('nvim_set_option_value', 'cursorline', true, {}) + child_session:request('nvim_set_option_value', 'list', true, {}) child_session:request('nvim_set_option_value', 'listchars', 'eol:$', {win=0}) feed_data('gg') local singlewidth_screen = [[ diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua index 3e1520e5fd..da14531fa2 100644 --- a/test/functional/terminal/window_split_tab_spec.lua +++ b/test/functional/terminal/window_split_tab_spec.lua @@ -71,7 +71,7 @@ describe(':terminal', function() end) it('does not change size if updated when not visible in any window #19665', function() - local channel = meths.get_option_value('channel', { buf = 0 }) + local channel = meths.get_option_value('channel', {}) command('enew') sleep(100) meths.chan_send(channel, 'foo') diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 324362a865..ccf1810ee1 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -1910,7 +1910,7 @@ describe('decorations: signs', function() } ns = meths.create_namespace 'test' - meths.set_option_value('signcolumn', 'auto:9', {win = 0}) + meths.set_option_value('signcolumn', 'auto:9', {}) end) local example_text = [[ @@ -2222,7 +2222,7 @@ l5 ]]} -- Check truncation works too - meths.set_option_value('signcolumn', 'auto', {win = 0}) + meths.set_option_value('signcolumn', 'auto', {}) screen:expect{grid=[[ S5^l1 | @@ -2233,7 +2233,7 @@ l5 it('does not set signcolumn for signs without text', function() screen:try_resize(20, 3) - meths.set_option_value('signcolumn', 'auto', {win = 0}) + meths.set_option_value('signcolumn', 'auto', {}) insert(example_text) feed 'gg' meths.buf_set_extmark(0, ns, 0, -1, {number_hl_group='Error'}) diff --git a/test/functional/vimscript/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua index 2d6d4b8e04..2a5720fbd7 100644 --- a/test/functional/vimscript/buf_functions_spec.lua +++ b/test/functional/vimscript/buf_functions_spec.lua @@ -268,7 +268,7 @@ describe('setbufvar() function', function() end) it('may set options, including window-local and global values', function() local buf1 = meths.get_current_buf() - eq(false, meths.get_option_value('number', {win=0})) + eq(false, meths.get_option_value('number', {})) command('split') command('new') eq(2, bufmeths.get_number(curwinmeths.get_buf()))