From 795f896a5772d5e0795f86642bdf90c82efac45c Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 12 Jan 2024 17:59:57 +0000 Subject: test: rename (meths, funcs) -> (api, fn) --- test/functional/ui/float_spec.lua | 820 +++++++++++++++++++------------------- 1 file changed, 410 insertions(+), 410 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 944e40876f..d08e346fc2 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -11,14 +11,14 @@ local expect = helpers.expect local exec = helpers.exec local exec_lua = helpers.exec_lua local insert = helpers.insert -local meths = helpers.meths -local funcs = helpers.funcs +local api = helpers.api +local fn = helpers.fn local run = helpers.run local pcall_err = helpers.pcall_err local tbl_contains = vim.tbl_contains -local curbuf = helpers.meths.nvim_get_current_buf -local curwin = helpers.meths.nvim_get_current_win -local curtab = helpers.meths.nvim_get_current_tabpage +local curbuf = helpers.api.nvim_get_current_buf +local curwin = helpers.api.nvim_get_current_win +local curtab = helpers.api.nvim_get_current_tabpage local NIL = vim.NIL describe('float window', function() @@ -31,36 +31,36 @@ describe('float window', function() -- Create three windows and test that ":wincmd " changes to the -- first window, if the previous window is invalid. command('split') - meths.nvim_open_win(0, true, {width=10, height=10, relative='editor', row=0, col=0}) - eq(1002, funcs.win_getid()) - eq('editor', meths.nvim_win_get_config(1002).relative) + api.nvim_open_win(0, true, {width=10, height=10, relative='editor', row=0, col=0}) + eq(1002, fn.win_getid()) + eq('editor', api.nvim_win_get_config(1002).relative) command([[ call nvim_win_close(1001, v:false) wincmd j ]]) - eq(1000, funcs.win_getid()) + eq(1000, fn.win_getid()) end) it('win_execute() should work' , function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'the floatwin', 'abc', 'def'}) - local win = meths.nvim_open_win(buf, false, {relative='win', width=16, height=1, row=0, col=10}) - local line = funcs.win_execute(win, 'echo getline(1)') + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'the floatwin', 'abc', 'def'}) + local win = api.nvim_open_win(buf, false, {relative='win', width=16, height=1, row=0, col=10}) + local line = fn.win_execute(win, 'echo getline(1)') eq('\nthe floatwin', line) - eq('\n1', funcs.win_execute(win, 'echo line(".",'..win.id..')')) - eq('\n3', funcs.win_execute(win, 'echo line("$",'..win.id..')')) - eq('\n0', funcs.win_execute(win, 'echo line("$", 123456)')) - funcs.win_execute(win, 'bwipe!') + eq('\n1', fn.win_execute(win, 'echo line(".",'..win.id..')')) + eq('\n3', fn.win_execute(win, 'echo line("$",'..win.id..')')) + eq('\n0', fn.win_execute(win, 'echo line("$", 123456)')) + fn.win_execute(win, 'bwipe!') end) it("win_execute() call commands that are not allowed when 'hidden' is not set" , function() command('set nohidden') - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'the floatwin'}) - local win = meths.nvim_open_win(buf, true, {relative='win', width=16, height=1, row=0, col=10}) - eq('Vim(close):E37: No write since last change (add ! to override)', pcall_err(funcs.win_execute, win, 'close')) - eq('Vim(bdelete):E89: No write since last change for buffer 2 (add ! to override)', pcall_err(funcs.win_execute, win, 'bdelete')) - funcs.win_execute(win, 'bwipe!') + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'the floatwin'}) + local win = api.nvim_open_win(buf, true, {relative='win', width=16, height=1, row=0, col=10}) + eq('Vim(close):E37: No write since last change (add ! to override)', pcall_err(fn.win_execute, win, 'close')) + eq('Vim(bdelete):E89: No write since last change for buffer 2 (add ! to override)', pcall_err(fn.win_execute, win, 'bdelete')) + fn.win_execute(win, 'bwipe!') end) it('closed immediately by autocmd #11383', function() @@ -193,7 +193,7 @@ describe('float window', function() end) it('opened with correct position relative to the mouse', function() - meths.nvim_input_mouse('left', 'press', '', 0, 10, 10) + api.nvim_input_mouse('left', 'press', '', 0, 10, 10) local pos = exec_lua([[ local bufnr = vim.api.nvim_create_buf(false, true) @@ -480,67 +480,67 @@ describe('float window', function() it('no crash with bufpos and non-existent window', function() command('new') - local closed_win = meths.nvim_get_current_win().id + local closed_win = api.nvim_get_current_win().id command('close') - local buf = meths.nvim_create_buf(false,false) - meths.nvim_open_win(buf, true, {relative='win', win=closed_win, width=1, height=1, bufpos={0,0}}) + local buf = api.nvim_create_buf(false,false) + api.nvim_open_win(buf, true, {relative='win', win=closed_win, width=1, height=1, bufpos={0,0}}) assert_alive() end) it("no segfault when setting minimal style after clearing local 'fillchars' #19510", function() local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1} - local float_win = meths.nvim_open_win(0, true, float_opts) - meths.nvim_set_option_value('fillchars', NIL, {win=float_win.id}) + local float_win = api.nvim_open_win(0, true, float_opts) + api.nvim_set_option_value('fillchars', NIL, {win=float_win.id}) float_opts.style = 'minimal' - meths.nvim_win_set_config(float_win, float_opts) + api.nvim_win_set_config(float_win, float_opts) assert_alive() end) it("should re-apply 'style' when present", function() local float_opts = {style = 'minimal', relative = 'editor', row = 1, col = 1, width = 1, height = 1} - local float_win = meths.nvim_open_win(0, true, float_opts) - meths.nvim_set_option_value('number', true, { win = float_win }) + local float_win = api.nvim_open_win(0, true, float_opts) + api.nvim_set_option_value('number', true, { win = float_win }) float_opts.row = 2 - meths.nvim_win_set_config(float_win, float_opts) - eq(false, meths.nvim_get_option_value('number', { win = float_win })) + api.nvim_win_set_config(float_win, float_opts) + eq(false, api.nvim_get_option_value('number', { win = float_win })) end) it("should not re-apply 'style' when missing", function() local float_opts = {style = 'minimal', relative = 'editor', row = 1, col = 1, width = 1, height = 1} - local float_win = meths.nvim_open_win(0, true, float_opts) - meths.nvim_set_option_value('number', true, { win = float_win }) + local float_win = api.nvim_open_win(0, true, float_opts) + api.nvim_set_option_value('number', true, { win = float_win }) float_opts.row = 2 float_opts.style = nil - meths.nvim_win_set_config(float_win, float_opts) - eq(true, meths.nvim_get_option_value('number', { win = float_win })) + api.nvim_win_set_config(float_win, float_opts) + eq(true, api.nvim_get_option_value('number', { win = float_win })) end) it("'scroll' is computed correctly when opening float with splitkeep=screen #20684", function() - meths.nvim_set_option_value('splitkeep', 'screen', {}) + api.nvim_set_option_value('splitkeep', 'screen', {}) local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10} - local float_win = meths.nvim_open_win(0, true, float_opts) - eq(5, meths.nvim_get_option_value('scroll', {win=float_win.id})) + local float_win = api.nvim_open_win(0, true, float_opts) + eq(5, api.nvim_get_option_value('scroll', {win=float_win.id})) end) it(':unhide works when there are floating windows', function() local float_opts = {relative = 'editor', row = 1, col = 1, width = 5, height = 5} local w0 = curwin() - meths.nvim_open_win(0, false, float_opts) - meths.nvim_open_win(0, false, float_opts) - eq(3, #meths.nvim_list_wins()) + api.nvim_open_win(0, false, float_opts) + api.nvim_open_win(0, false, float_opts) + eq(3, #api.nvim_list_wins()) command('unhide') - eq({ w0 }, meths.nvim_list_wins()) + eq({ w0 }, api.nvim_list_wins()) end) it(':all works when there are floating windows', function() command('args Xa.txt') local float_opts = {relative = 'editor', row = 1, col = 1, width = 5, height = 5} local w0 = curwin() - meths.nvim_open_win(0, false, float_opts) - meths.nvim_open_win(0, false, float_opts) - eq(3, #meths.nvim_list_wins()) + api.nvim_open_win(0, false, float_opts) + api.nvim_open_win(0, false, float_opts) + eq(3, #api.nvim_list_wins()) command('all') - eq({ w0 }, meths.nvim_list_wins()) + eq({ w0 }, api.nvim_list_wins()) end) describe('with only one tabpage,', function() @@ -553,37 +553,37 @@ describe('float window', function() end) describe('closing the last non-floating window gives E444', function() before_each(function() - meths.nvim_open_win(old_buf, true, float_opts) + api.nvim_open_win(old_buf, true, float_opts) end) it('if called from non-floating window', function() - meths.nvim_set_current_win(old_win) + api.nvim_set_current_win(old_win) eq('Vim:E444: Cannot close last window', - pcall_err(meths.nvim_win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) it('if called from floating window', function() eq('Vim:E444: Cannot close last window', - pcall_err(meths.nvim_win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) end) describe("deleting the last non-floating window's buffer", function() describe('leaves one window with an empty buffer when there is only one buffer', function() local same_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() eq(old_win, curwin().id) expect('') - eq(1, #meths.nvim_list_wins()) + eq(1, #api.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) end) it('if called from floating window', function() - meths.nvim_set_current_win(same_buf_float) + api.nvim_set_current_win(same_buf_float) command('autocmd WinLeave * let g:win_leave = nvim_get_current_win()') command('autocmd WinEnter * let g:win_enter = nvim_get_current_win()') - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, eval('g:win_leave')) eq(old_win, eval('g:win_enter')) end) @@ -591,67 +591,67 @@ describe('float window', function() describe('closes other windows with that buffer when there are other buffers', function() local same_buf_float, other_buf, other_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id - other_buf = meths.nvim_create_buf(true, false).id - other_buf_float = meths.nvim_open_win(other_buf, true, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id + other_buf = api.nvim_create_buf(true, false).id + other_buf_float = api.nvim_open_win(other_buf, true, float_opts).id insert('bar') - meths.nvim_set_current_win(old_win) + api.nvim_set_current_win(old_win) end) after_each(function() eq(other_buf, curbuf().id) expect('bar') - eq(2, #meths.nvim_list_wins()) + eq(2, #api.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from floating window with the same buffer', function() - meths.nvim_set_current_win(same_buf_float) + api.nvim_set_current_win(same_buf_float) command('autocmd WinLeave * let g:win_leave = nvim_get_current_win()') command('autocmd WinEnter * let g:win_enter = nvim_get_current_win()') - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, eval('g:win_leave')) eq(old_win, eval('g:win_enter')) eq(old_win, curwin().id) end) -- TODO: this case is too hard to deal with pending('if called from floating window with another buffer', function() - meths.nvim_set_current_win(other_buf_float) - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_set_current_win(other_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) end) end) describe('creates an empty buffer when there is only one listed buffer', function() local same_buf_float, unlisted_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id - local unlisted_buf = meths.nvim_create_buf(true, false).id - unlisted_buf_float = meths.nvim_open_win(unlisted_buf, true, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id + local unlisted_buf = api.nvim_create_buf(true, false).id + unlisted_buf_float = api.nvim_open_win(unlisted_buf, true, float_opts).id insert('unlisted') command('set nobuflisted') - meths.nvim_set_current_win(old_win) + api.nvim_set_current_win(old_win) end) after_each(function() expect('') - eq(2, #meths.nvim_list_wins()) + eq(2, #api.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from floating window with the same buffer', function() - meths.nvim_set_current_win(same_buf_float) + api.nvim_set_current_win(same_buf_float) command('autocmd WinLeave * let g:win_leave = nvim_get_current_win()') command('autocmd WinEnter * let g:win_enter = nvim_get_current_win()') - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, eval('g:win_leave')) eq(old_win, eval('g:win_enter')) eq(old_win, curwin().id) end) -- TODO: this case is too hard to deal with pending('if called from floating window with an unlisted buffer', function() - meths.nvim_set_current_win(unlisted_buf_float) - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_set_current_win(unlisted_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) end) end) end) @@ -662,20 +662,20 @@ describe('float window', function() command('botright vnew') insert('unlisted') command('set nobuflisted') - meths.nvim_set_current_win(old_win) - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + api.nvim_set_current_win(old_win) + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() expect('') - eq(2, #meths.nvim_list_wins()) + eq(2, #api.nvim_list_wins()) end) it('if called from non-floating window with the deleted buffer', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from floating window with the deleted buffer', function() - meths.nvim_set_current_win(same_buf_float) - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_set_current_win(same_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, curwin().id) end) end) @@ -697,28 +697,28 @@ describe('float window', function() describe('without splits, deleting the last listed buffer creates an empty buffer', function() local same_buf_float before_each(function() - meths.nvim_set_current_win(old_win) - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + api.nvim_set_current_win(old_win) + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() expect('') - eq(2, #meths.nvim_list_wins()) - eq(2, #meths.nvim_list_tabpages()) + eq(2, #api.nvim_list_wins()) + eq(2, #api.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from non-floating window in another tabpage', function() command('tab split') - eq(3, #meths.nvim_list_tabpages()) - meths.nvim_buf_delete(old_buf, {force = true}) + eq(3, #api.nvim_list_tabpages()) + api.nvim_buf_delete(old_buf, {force = true}) end) it('if called from floating window with the same buffer', function() - meths.nvim_set_current_win(same_buf_float) + api.nvim_set_current_win(same_buf_float) command('autocmd WinLeave * let g:win_leave = nvim_get_current_win()') command('autocmd WinEnter * let g:win_enter = nvim_get_current_win()') - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, eval('g:win_leave')) eq(old_win, eval('g:win_enter')) eq(old_win, curwin().id) @@ -728,22 +728,22 @@ describe('float window', function() local same_buf_float before_each(function() command('botright vsplit') - meths.nvim_set_current_buf(unlisted_buf) - meths.nvim_set_current_win(old_win) - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + api.nvim_set_current_buf(unlisted_buf) + api.nvim_set_current_win(old_win) + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() expect('') - eq(3, #meths.nvim_list_wins()) - eq(2, #meths.nvim_list_tabpages()) + eq(3, #api.nvim_list_wins()) + eq(2, #api.nvim_list_tabpages()) end) it('if called from non-floating window with the deleted buffer', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from floating window with the deleted buffer', function() - meths.nvim_set_current_win(same_buf_float) - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_set_current_win(same_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, curwin().id) end) end) @@ -763,38 +763,38 @@ describe('float window', function() describe('closes the tabpage when all floating windows are closeable', function() local same_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() eq(old_tabpage, curtab().id) expect('oldtab') - eq(1, #meths.nvim_list_tabpages()) + eq(1, #api.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.nvim_win_close(old_win, false) + api.nvim_win_close(old_win, false) end) it('if called from floating window', function() - meths.nvim_set_current_win(same_buf_float) - meths.nvim_win_close(old_win, false) + api.nvim_set_current_win(same_buf_float) + api.nvim_win_close(old_win, false) end) end) describe('gives E5601 when there are non-closeable floating windows', function() local other_buf_float before_each(function() command('set nohidden') - local other_buf = meths.nvim_create_buf(true, false).id - other_buf_float = meths.nvim_open_win(other_buf, true, float_opts).id + local other_buf = api.nvim_create_buf(true, false).id + other_buf_float = api.nvim_open_win(other_buf, true, float_opts).id insert('foo') - meths.nvim_set_current_win(old_win) + api.nvim_set_current_win(old_win) end) it('if called from non-floating window', function() eq('Vim:E5601: Cannot close window, only floating window would remain', - pcall_err(meths.nvim_win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) it('if called from floating window', function() - meths.nvim_set_current_win(other_buf_float) + api.nvim_set_current_win(other_buf_float) eq('Vim:E5601: Cannot close window, only floating window would remain', - pcall_err(meths.nvim_win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) end) end) @@ -802,27 +802,27 @@ describe('float window', function() describe('closes the tabpage when all floating windows are closeable', function() local same_buf_float, other_buf, other_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id - other_buf = meths.nvim_create_buf(true, false).id - other_buf_float = meths.nvim_open_win(other_buf, true, float_opts).id - meths.nvim_set_current_win(old_win) + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id + other_buf = api.nvim_create_buf(true, false).id + other_buf_float = api.nvim_open_win(other_buf, true, float_opts).id + api.nvim_set_current_win(old_win) end) after_each(function() eq(old_tabpage, curtab().id) expect('oldtab') - eq(1, #meths.nvim_list_tabpages()) + eq(1, #api.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = false}) + api.nvim_buf_delete(old_buf, {force = false}) end) it('if called from floating window with the same buffer', function() - meths.nvim_set_current_win(same_buf_float) - meths.nvim_buf_delete(old_buf, {force = false}) + api.nvim_set_current_win(same_buf_float) + api.nvim_buf_delete(old_buf, {force = false}) end) -- TODO: this case is too hard to deal with pending('if called from floating window with another buffer', function() - meths.nvim_set_current_win(other_buf_float) - meths.nvim_buf_delete(old_buf, {force = false}) + api.nvim_set_current_win(other_buf_float) + api.nvim_buf_delete(old_buf, {force = false}) end) end) -- TODO: what to do when there are non-closeable floating windows? @@ -869,8 +869,8 @@ describe('float window', function() end) it('can be created and reconfigured', function() - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) local expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 5, true}, } @@ -901,7 +901,7 @@ describe('float window', function() end - meths.nvim_win_set_config(win, {relative='editor', row=0, col=10}) + api.nvim_win_set_config(win, {relative='editor', row=0, col=10}) expected_pos[4][4] = 0 expected_pos[4][5] = 10 if multigrid then @@ -927,7 +927,7 @@ describe('float window', function() ]]) end - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -950,8 +950,8 @@ describe('float window', function() it('window position fixed', function() command('rightbelow 20vsplit') - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, false, { + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, false, { relative='win', width=15, height=2, row=2, col=10, anchor='NW', fixed=true}) if multigrid then @@ -986,7 +986,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {fixed=false}) + api.nvim_win_set_config(win, {fixed=false}) if multigrid then screen:expect_unchanged() @@ -1010,8 +1010,8 @@ describe('float window', function() -- or something. command("set redrawdebug=compositor") command("set wd=1") - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) local expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 5, true}, } @@ -1042,7 +1042,7 @@ describe('float window', function() end - meths.nvim_win_set_config(win, {relative='editor', row=0, col=10}) + api.nvim_win_set_config(win, {relative='editor', row=0, col=10}) expected_pos[4][4] = 0 expected_pos[4][5] = 10 if multigrid then @@ -1068,7 +1068,7 @@ describe('float window', function() ]]) end - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -1090,16 +1090,16 @@ describe('float window', function() end) it('return their configuration', function() - local buf = meths.nvim_create_buf(false, false) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60}) + local buf = api.nvim_create_buf(false, false) + local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60}) local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false} - eq(expected, meths.nvim_win_get_config(win)) + eq(expected, api.nvim_win_get_config(win)) - eq({relative='', external=false, focusable=true, hide=false}, meths.nvim_win_get_config(0)) + eq({relative='', external=false, focusable=true, hide=false}, api.nvim_win_get_config(0)) if multigrid then - meths.nvim_win_set_config(win, {external=true, width=10, height=1}) - eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, meths.nvim_win_get_config(win)) + api.nvim_win_set_config(win, {external=true, width=10, height=1}) + eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, api.nvim_win_get_config(win)) end end) @@ -1107,7 +1107,7 @@ describe('float window', function() command('set number') command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ixygg') - local win = meths.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10}) + local win = api.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1138,8 +1138,8 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false, true) - meths.nvim_win_set_buf(win, buf) + local buf = api.nvim_create_buf(false, true) + api.nvim_win_set_buf(win, buf) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1175,7 +1175,7 @@ describe('float window', function() command('set foldcolumn=1') command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ixygg') - local win = meths.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + local win = api.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1239,8 +1239,8 @@ describe('float window', function() end command('sign unplace 1 buffer=1') - local buf = meths.nvim_create_buf(false, true) - meths.nvim_win_set_buf(win, buf) + local buf = api.nvim_create_buf(false, true) + api.nvim_win_set_buf(win, buf) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1275,7 +1275,7 @@ describe('float window', function() command('set foldcolumn=1') command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ixygg') - local win = meths.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + local win = api.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1339,8 +1339,8 @@ describe('float window', function() end command('sign unplace 1 buffer=1') - local buf = meths.nvim_create_buf(false, true) - meths.nvim_win_set_buf(win, buf) + local buf = api.nvim_create_buf(false, true) + api.nvim_win_set_buf(win, buf) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1376,7 +1376,7 @@ describe('float window', function() command('set statuscolumn=%l%s%C') command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ixygg') - meths.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + api.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1407,10 +1407,10 @@ describe('float window', function() end) it('can have border', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=9, height=2, row=2, col=5, border="double"}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=9, height=2, row=2, col=5, border="double"}) if multigrid then screen:expect{grid=[[ @@ -1445,7 +1445,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border="single"}) + api.nvim_win_set_config(win, {border="single"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1479,7 +1479,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border="rounded"}) + api.nvim_win_set_config(win, {border="rounded"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1513,7 +1513,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border="solid"}) + api.nvim_win_set_config(win, {border="solid"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1548,7 +1548,7 @@ describe('float window', function() end -- support: ascii char, UTF-8 char, composed char, highlight per char - meths.nvim_win_set_config(win, {border={"x", {"å", "ErrorMsg"}, {"\\"}, {"n̈̊", "Search"}}}) + api.nvim_win_set_config(win, {border={"x", {"å", "ErrorMsg"}, {"\\"}, {"n̈̊", "Search"}}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1582,7 +1582,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border="none"}) + api.nvim_win_set_config(win, {border="none"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1613,7 +1613,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border={"", "", "", ">", "", "", "", "<"}}) + api.nvim_win_set_config(win, {border={"", "", "", ">", "", "", "", "<"}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1644,7 +1644,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border={"", "_", "", "", "", "-", "", ""}}) + api.nvim_win_set_config(win, {border={"", "_", "", "", "", "-", "", ""}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1686,7 +1686,7 @@ describe('float window', function() of border shadow ]] - meths.nvim_win_set_config(win, {border="shadow"}) + api.nvim_win_set_config(win, {border="shadow"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1725,13 +1725,13 @@ describe('float window', function() end) it('validates title title_pos', function() - local buf = meths.nvim_create_buf(false,false) + local buf = api.nvim_create_buf(false,false) eq("title requires border to be set", - pcall_err(meths.nvim_open_win,buf, false, { + pcall_err(api.nvim_open_win,buf, false, { relative='editor', width=9, height=2, row=2, col=5, title='Title', })) eq("title_pos requires title to be set", - pcall_err(meths.nvim_open_win,buf, false, { + pcall_err(api.nvim_open_win,buf, false, { relative='editor', width=9, height=2, row=2, col=5, border='single', title_pos='left', })) @@ -1759,13 +1759,13 @@ describe('float window', function() end) it('validates footer footer_pos', function() - local buf = meths.nvim_create_buf(false,false) + local buf = api.nvim_create_buf(false,false) eq("footer requires border to be set", - pcall_err(meths.nvim_open_win,buf, false, { + pcall_err(api.nvim_open_win,buf, false, { relative='editor', width=9, height=2, row=2, col=5, footer='Footer', })) eq("footer_pos requires footer to be set", - pcall_err(meths.nvim_open_win,buf, false, { + pcall_err(api.nvim_open_win,buf, false, { relative='editor', width=9, height=2, row=2, col=5, border='single', footer_pos='left', })) @@ -1793,10 +1793,10 @@ describe('float window', function() end) it('center aligned title longer than window width #25746', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, { + local win = api.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", title = "abcdefghijklmnopqrstuvwxyz",title_pos = "center", }) @@ -1834,15 +1834,15 @@ describe('float window', function() ]]} end - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) assert_alive() end) it('border with title', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, { + local win = api.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", title = "Left",title_pos = "left", }) @@ -1880,7 +1880,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= "Center",title_pos="center"}) + api.nvim_win_set_config(win, {title= "Center",title_pos="center"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1914,7 +1914,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= "Right",title_pos="right"}) + api.nvim_win_set_config(win, {title= "Right",title_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1948,7 +1948,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= { {"🦄"},{"BB"}},title_pos="right"}) + api.nvim_win_set_config(win, {title= { {"🦄"},{"BB"}},title_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1984,10 +1984,10 @@ describe('float window', function() end) it('border with footer', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, { + local win = api.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", footer = "Left",footer_pos = "left", }) @@ -2025,7 +2025,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {footer= "Center",footer_pos="center"}) + api.nvim_win_set_config(win, {footer= "Center",footer_pos="center"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2059,7 +2059,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {footer= "Right",footer_pos="right"}) + api.nvim_win_set_config(win, {footer= "Right",footer_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2093,7 +2093,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {footer= { {"🦄"},{"BB"}},footer_pos="right"}) + api.nvim_win_set_config(win, {footer= { {"🦄"},{"BB"}},footer_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2129,10 +2129,10 @@ describe('float window', function() end) it('border with title and footer', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, { + local win = api.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", title = "Left", title_pos = "left", footer = "Right", footer_pos = "right", }) @@ -2170,7 +2170,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= "Center",title_pos="center",footer= "Center",footer_pos="center"}) + api.nvim_win_set_config(win, {title= "Center",title_pos="center",footer= "Center",footer_pos="center"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2204,7 +2204,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= "Right",title_pos="right",footer= "Left",footer_pos="left"}) + api.nvim_win_set_config(win, {title= "Right",title_pos="right",footer= "Left",footer_pos="left"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2240,7 +2240,7 @@ describe('float window', function() command('hi B0 guibg=Red guifg=Black') command('hi B1 guifg=White') - meths.nvim_win_set_config(win, { + api.nvim_win_set_config(win, { title = {{"🦄"}, {"BB", {"B0", "B1"}}}, title_pos = "right", footer= {{"🦄"}, {"BB", {"B0", "B1"}}}, footer_pos = "right", }) @@ -2279,8 +2279,8 @@ describe('float window', function() end) it('terminates border on edge of viewport when window extends past viewport', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_open_win(buf, false, {relative='editor', width=40, height=7, row=0, col=0, border="single", zindex=201}) + local buf = api.nvim_create_buf(false, false) + api.nvim_open_win(buf, false, {relative='editor', width=40, height=7, row=0, col=0, border="single", zindex=201}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2314,10 +2314,10 @@ describe('float window', function() it('with border show popupmenu', function() screen:try_resize(40,10) - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', 'abb acc ', ''}) - meths.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5, border="double"}) + api.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5, border="double"}) feed 'G' if multigrid then @@ -2483,10 +2483,10 @@ describe('float window', function() it('show ruler of current floating window', function() command 'set ruler' - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', 'abb acc '}) - meths.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5}) + api.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5}) feed 'gg' if multigrid then @@ -2553,7 +2553,7 @@ describe('float window', function() it("correct ruler position in current float with 'rulerformat' set", function() command 'set ruler rulerformat=fish:<><' - meths.nvim_open_win(0, true, {relative='editor', width=9, height=3, row=0, col=5}) + api.nvim_open_win(0, true, {relative='editor', width=9, height=3, row=0, col=5}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2586,11 +2586,11 @@ describe('float window', function() it('does not show ruler of not-last current float during ins-completion', function() screen:try_resize(50,9) command 'set ruler showmode' - meths.nvim_open_win(0, false, {relative='editor', width=3, height=3, row=0, col=0}) - meths.nvim_open_win(0, false, {relative='editor', width=3, height=3, row=0, col=5}) + api.nvim_open_win(0, false, {relative='editor', width=3, height=3, row=0, col=0}) + api.nvim_open_win(0, false, {relative='editor', width=3, height=3, row=0, col=5}) feed 'w' - neq('', meths.nvim_win_get_config(0).relative) - neq(funcs.winnr '$', funcs.winnr()) + neq('', api.nvim_win_get_config(0).relative) + neq(fn.winnr '$', fn.winnr()) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2660,9 +2660,9 @@ describe('float window', function() it('can have minimum size', function() insert("the background text") - local buf = meths.nvim_create_buf(false, true) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'x'}) - local win = meths.nvim_open_win(buf, false, {relative='win', width=1, height=1, row=0, col=4, focusable=false}) + local buf = api.nvim_create_buf(false, true) + api.nvim_buf_set_lines(buf, 0, -1, true, {'x'}) + local win = api.nvim_open_win(buf, false, {relative='win', width=1, height=1, row=0, col=4, focusable=false}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2686,7 +2686,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='win', row=0, col=15}) + api.nvim_win_set_config(win, {relative='win', row=0, col=15}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2710,7 +2710,7 @@ describe('float window', function() ]]) end - meths.nvim_win_close(win,false) + api.nvim_win_close(win,false) if multigrid then screen:expect([[ ## grid 1 @@ -2746,8 +2746,8 @@ describe('float window', function() command('sargument 6') local float_opts = { relative = 'editor', row = 6, col = 0, width = 40, height = 1 } - meths.nvim_win_set_config(w3, float_opts) - meths.nvim_win_set_config(w4, float_opts) + api.nvim_win_set_config(w3, float_opts) + api.nvim_win_set_config(w4, float_opts) command('wincmd =') if multigrid then screen:expect{grid=[[ @@ -2876,36 +2876,36 @@ describe('float window', function() end) it('API has proper error messages', function() - local buf = meths.nvim_create_buf(false,false) + local buf = api.nvim_create_buf(false,false) eq("Invalid key: 'bork'", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,bork=true})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,bork=true})) eq("'win' key is only valid with relative='win'", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0})) eq("Only one of 'relative' and 'external' must be used", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,external=true})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,external=true})) eq("Invalid value of 'relative' key", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0})) eq("Invalid value of 'anchor' key", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,anchor='bottom'})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,anchor='bottom'})) eq("'relative' requires 'row'/'col' or 'bufpos'", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='editor'})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='editor'})) eq("'width' key must be a positive Integer", - pcall_err(meths.nvim_open_win,buf, false, {width=-1,height=2,relative='editor', row=0, col=0})) + pcall_err(api.nvim_open_win,buf, false, {width=-1,height=2,relative='editor', row=0, col=0})) eq("'height' key must be a positive Integer", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=-1,relative='editor', row=0, col=0})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=-1,relative='editor', row=0, col=0})) eq("'height' key must be a positive Integer", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=0,relative='editor', row=0, col=0})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=0,relative='editor', row=0, col=0})) eq("Must specify 'width'", - pcall_err(meths.nvim_open_win,buf, false, {relative='editor', row=0, col=0})) + pcall_err(api.nvim_open_win,buf, false, {relative='editor', row=0, col=0})) eq("Must specify 'height'", - pcall_err(meths.nvim_open_win,buf, false, {relative='editor', row=0, col=0, width=2})) + pcall_err(api.nvim_open_win,buf, false, {relative='editor', row=0, col=0, width=2})) end) it('can be placed relative window or cursor', function() screen:try_resize(40,9) - meths.nvim_buf_set_lines(0, 0, -1, true, {'just some', 'example text'}) + api.nvim_buf_set_lines(0, 0, -1, true, {'just some', 'example text'}) feed('gge') - local oldwin = meths.nvim_get_current_win() + local oldwin = api.nvim_get_current_win() command('below split') if multigrid then screen:expect([[ @@ -2940,9 +2940,9 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false,false) + local buf = api.nvim_create_buf(false,false) -- no 'win' arg, relative default window - local win = meths.nvim_open_win(buf, false, {relative='win', width=20, height=2, row=0, col=10}) + local win = api.nvim_open_win(buf, false, {relative='win', width=20, height=2, row=0, col=10}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2981,7 +2981,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=1, col=-2}) + api.nvim_win_set_config(win, {relative='cursor', row=1, col=-2}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3020,7 +3020,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=0, col=0, anchor='SW'}) + api.nvim_win_set_config(win, {relative='cursor', row=0, col=0, anchor='SW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3059,7 +3059,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='win', win=oldwin, row=1, col=10, anchor='NW'}) + api.nvim_win_set_config(win, {relative='win', win=oldwin, row=1, col=10, anchor='NW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3098,7 +3098,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='win', win=oldwin, row=3, col=39, anchor='SE'}) + api.nvim_win_set_config(win, {relative='win', win=oldwin, row=3, col=39, anchor='SE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3137,7 +3137,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='win', win=0, row=0, col=50, anchor='NE'}) + api.nvim_win_set_config(win, {relative='win', win=0, row=0, col=50, anchor='NE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3207,7 +3207,7 @@ describe('float window', function() it('always anchor to corner including border', function() screen:try_resize(40,13) - meths.nvim_buf_set_lines(0, 0, -1, true, {'just some example text', 'some more example text'}) + api.nvim_buf_set_lines(0, 0, -1, true, {'just some example text', 'some more example text'}) feed('ggeee') command('below split') if multigrid then @@ -3243,10 +3243,10 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, {relative='cursor', width=9, height=2, row=1, col=-2, border="double"}) + local win = api.nvim_open_win(buf, false, {relative='cursor', width=9, height=2, row=1, col=-2, border="double"}) if multigrid then screen:expect{grid=[[ @@ -3290,7 +3290,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='NE'}) + api.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='NE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3333,7 +3333,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=1, col=-2, anchor='SE'}) + api.nvim_win_set_config(win, {relative='cursor', row=1, col=-2, anchor='SE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3376,7 +3376,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='SW'}) + api.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='SW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3596,8 +3596,8 @@ describe('float window', function() it('can be placed relative text in a window', function() screen:try_resize(30,5) - local firstwin = meths.nvim_get_current_win().id - meths.nvim_buf_set_lines(0, 0, -1, true, {'just some', 'example text that is wider than the window', '', '', 'more text'}) + local firstwin = api.nvim_get_current_win().id + api.nvim_buf_set_lines(0, 0, -1, true, {'just some', 'example text that is wider than the window', '', '', 'more text'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3620,10 +3620,10 @@ describe('float window', function() ]]} end - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'some info!'}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'some info!'}) - local win = meths.nvim_open_win(buf, false, {relative='win', width=12, height=1, bufpos={1,32}}) + local win = api.nvim_open_win(buf, false, {relative='win', width=12, height=1, bufpos={1,32}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3651,7 +3651,7 @@ describe('float window', function() ]]} end eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW', hide=false, - external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, meths.nvim_win_get_config(win)) + external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, api.nvim_win_get_config(win)) feed('') if multigrid then @@ -3739,7 +3739,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='SW'}) + api.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='SW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3812,7 +3812,7 @@ describe('float window', function() end command('close') - meths.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='NW', col=-2}) + api.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='NW', col=-2}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3843,7 +3843,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {relative='win', bufpos={1,32}, row=2}) + api.nvim_win_set_config(win, {relative='win', bufpos={1,32}, row=2}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3924,9 +3924,9 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false,true) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'some floaty text'}) - meths.nvim_open_win(buf, false, {relative='editor', width=20, height=1, row=3, col=1}) + local buf = api.nvim_create_buf(false,true) + api.nvim_buf_set_lines(buf, 0, -1, true, {'some floaty text'}) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=1, row=3, col=1}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3959,8 +3959,8 @@ describe('float window', function() local screen2 = Screen.new(40,7) screen2:attach(nil, session2) screen2:set_default_attr_ids(attrs) - local buf = meths.nvim_create_buf(false,false) - meths.nvim_open_win(buf, true, {relative='editor', width=20, height=2, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_open_win(buf, true, {relative='editor', width=20, height=2, row=2, col=5}) local expected_pos = { [2]={{id=1001}, 'NW', 1, 2, 5} } @@ -3986,9 +3986,9 @@ describe('float window', function() it('handles resized screen', function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'such', 'very', 'float'}) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=15, height=4, row=2, col=10}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'such', 'very', 'float'}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=15, height=4, row=2, col=10}) local expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 10, true}, } @@ -4151,7 +4151,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {height=3}) + api.nvim_win_set_config(win, {height=3}) feed('gg') if multigrid then screen:expect{grid=[[ @@ -4436,8 +4436,8 @@ describe('float window', function() command("set inccommand=split") command("set laststatus=2") - local buf = meths.nvim_create_buf(false,false) - meths.nvim_open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0}) + local buf = api.nvim_create_buf(false,false) + api.nvim_open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0}) insert([[ foo @@ -4533,17 +4533,17 @@ describe('float window', function() end) it('does not crash when set cmdheight #9680', function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) command("set cmdheight=2") - eq(1, meths.nvim_eval('1')) + eq(1, api.nvim_eval('1')) end) describe('and completion', function() before_each(function() - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5}).id - meths.nvim_set_option_value('winhl', 'Normal:ErrorMsg', {win=win}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5}).id + api.nvim_set_option_value('winhl', 'Normal:ErrorMsg', {win=win}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4573,7 +4573,7 @@ describe('float window', function() it('with builtin popupmenu', function() feed('ix ') - funcs.complete(3, {'aa', 'word', 'longtext'}) + fn.complete(3, {'aa', 'word', 'longtext'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4636,7 +4636,7 @@ describe('float window', function() end feed('wi') - funcs.complete(1, {'xx', 'yy', 'zz'}) + fn.complete(1, {'xx', 'yy', 'zz'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4736,7 +4736,7 @@ describe('float window', function() it('with ext_popupmenu', function() screen:set_option('ext_popupmenu', true) feed('ix ') - funcs.complete(3, {'aa', 'word', 'longtext'}) + fn.complete(3, {'aa', 'word', 'longtext'}) local items = {{"aa", "", "", ""}, {"word", "", "", ""}, {"longtext", "", "", ""}} if multigrid then screen:expect{grid=[[ @@ -4796,7 +4796,7 @@ describe('float window', function() end feed('wi') - funcs.complete(1, {'xx', 'yy', 'zz'}) + fn.complete(1, {'xx', 'yy', 'zz'}) items = {{"xx", "", "", ""}, {"yy", "", "", ""}, {"zz", "", "", ""}} if multigrid then screen:expect{grid=[[ @@ -4862,7 +4862,7 @@ describe('float window', function() before_each(function() command('hi NormalFloat guibg=#333333 guifg=NONE') feed('i') - funcs.complete(1, {'aa', 'word', 'longtext'}) + fn.complete(1, {'aa', 'word', 'longtext'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4891,9 +4891,9 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false,true) - meths.nvim_buf_set_lines(buf,0,-1,true,{"some info", "about item"}) - win = meths.nvim_open_win(buf, false, {relative='cursor', width=12, height=2, row=1, col=10}) + local buf = api.nvim_create_buf(false,true) + api.nvim_buf_set_lines(buf,0,-1,true,{"some info", "about item"}) + win = api.nvim_open_win(buf, false, {relative='cursor', width=12, height=2, row=1, col=10}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4955,7 +4955,7 @@ describe('float window', function() ]]) end - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -4977,7 +4977,7 @@ describe('float window', function() end) it('and close float first', function() - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -5029,10 +5029,10 @@ describe('float window', function() end) it("can use Normal as background", function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf,0,-1,true,{"here", "float"}) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.nvim_set_option_value('winhl', 'Normal:Normal', {win=win}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf,0,-1,true,{"here", "float"}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + api.nvim_set_option_value('winhl', 'Normal:Normal', {win=win}) if multigrid then screen:expect{grid=[[ @@ -5072,10 +5072,10 @@ describe('float window', function() -- the default, but be explicit: command("set laststatus=1") command("set hidden") - meths.nvim_buf_set_lines(0,0,-1,true,{"x"}) - local buf = meths.nvim_create_buf(false,false) - win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.nvim_buf_set_lines(buf,0,-1,true,{"y"}) + api.nvi