diff options
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r-- | test/functional/ui/float_spec.lua | 5239 |
1 files changed, 1524 insertions, 3715 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 2902b4a4a5..cdb3b79963 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1,6 +1,5 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local global_helpers = require('test.helpers') local os = require('os') local clear, feed = helpers.clear, helpers.feed local assert_alive = helpers.assert_alive @@ -12,14 +11,15 @@ local expect = helpers.expect local exec = helpers.exec local exec_lua = helpers.exec_lua local insert = helpers.insert -local meths = helpers.meths -local curbufmeths = helpers.curbufmeths -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 = global_helpers.tbl_contains -local curbuf, curwin, curtab = helpers.curbuf, helpers.curwin, helpers.curtab -local NIL = helpers.NIL +local tbl_contains = vim.tbl_contains +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() before_each(function() @@ -31,36 +31,36 @@ describe('float window', function() -- Create three windows and test that ":wincmd <direction>" changes to the -- first window, if the previous window is invalid. command('split') - meths.open_win(0, true, {width=10, height=10, relative='editor', row=0, col=0}) - eq(1002, funcs.win_getid()) - eq('editor', meths.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.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {'the floatwin', 'abc', 'def'}) - local win = meths.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..')')) + eq('\n3', fn.win_execute(win, 'echo line("$",'..win..')')) + 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.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {'the floatwin'}) - local win = meths.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() @@ -104,14 +104,20 @@ describe('float window', function() end) it('open with WinNew autocmd', function() - local res = exec_lua([[ - local triggerd = false + local new_triggered_before_enter, new_curwin, win = unpack(exec_lua([[ + local enter_triggered = false + local new_triggered_before_enter = false + local new_curwin local buf = vim.api.nvim_create_buf(true, true) + vim.api.nvim_create_autocmd('WinEnter', { + callback = function() + enter_triggered = true + end + }) vim.api.nvim_create_autocmd('WinNew', { - callback = function(opt) - if opt.buf == buf then - triggerd = true - end + callback = function() + new_triggered_before_enter = not enter_triggered + new_curwin = vim.api.nvim_get_current_win() end }) local opts = { @@ -120,10 +126,11 @@ describe('float window', function() width = 1, height = 1, noautocmd = false, } - vim.api.nvim_open_win(buf, true, opts) - return triggerd - ]]) - eq(true, res) + local win = vim.api.nvim_open_win(buf, true, opts) + return {new_triggered_before_enter, new_curwin, win} + ]])) + eq(true, new_triggered_before_enter) + eq(win, new_curwin) end) it('opened with correct height', function() @@ -193,7 +200,7 @@ describe('float window', function() end) it('opened with correct position relative to the mouse', function() - meths.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 +487,67 @@ describe('float window', function() it('no crash with bufpos and non-existent window', function() command('new') - local closed_win = meths.get_current_win().id + local closed_win = api.nvim_get_current_win() command('close') - local buf = meths.create_buf(false,false) - meths.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.open_win(0, true, float_opts) - meths.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}) float_opts.style = 'minimal' - meths.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.open_win(0, true, float_opts) - meths.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.win_set_config(float_win, float_opts) - eq(false, meths.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.open_win(0, true, float_opts) - meths.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.win_set_config(float_win, float_opts) - eq(true, meths.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.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.open_win(0, true, float_opts) - eq(5, meths.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})) 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.open_win(0, false, float_opts) - meths.open_win(0, false, float_opts) - eq(3, #meths.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.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.open_win(0, false, float_opts) - meths.open_win(0, false, float_opts) - eq(3, #meths.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.list_wins()) + eq({ w0 }, api.nvim_list_wins()) end) describe('with only one tabpage,', function() @@ -548,42 +555,42 @@ describe('float window', function() local old_buf, old_win before_each(function() insert('foo') - old_buf = curbuf().id - old_win = curwin().id + old_buf = curbuf() + old_win = curwin() end) describe('closing the last non-floating window gives E444', function() before_each(function() - meths.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.set_current_win(old_win) + api.nvim_set_current_win(old_win) eq('Vim:E444: Cannot close last window', - pcall_err(meths.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.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.open_win(old_buf, false, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts) end) after_each(function() - eq(old_win, curwin().id) + eq(old_win, curwin()) expect('') - eq(1, #meths.list_wins()) + eq(1, #api.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) end) it('if called from floating window', function() - meths.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.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 +598,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.open_win(old_buf, false, float_opts).id - other_buf = meths.create_buf(true, false).id - other_buf_float = meths.open_win(other_buf, true, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts) + other_buf = api.nvim_create_buf(true, false) + other_buf_float = api.nvim_open_win(other_buf, true, float_opts) insert('bar') - meths.set_current_win(old_win) + api.nvim_set_current_win(old_win) end) after_each(function() - eq(other_buf, curbuf().id) + eq(other_buf, curbuf()) expect('bar') - eq(2, #meths.list_wins()) + eq(2, #api.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.buf_delete(old_buf, {force = true}) - eq(old_win, curwin().id) + api.nvim_buf_delete(old_buf, {force = true}) + eq(old_win, curwin()) end) it('if called from floating window with the same buffer', function() - meths.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.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) + eq(old_win, curwin()) end) -- TODO: this case is too hard to deal with pending('if called from floating window with another buffer', function() - meths.set_current_win(other_buf_float) - meths.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.open_win(old_buf, false, float_opts).id - local unlisted_buf = meths.create_buf(true, false).id - unlisted_buf_float = meths.open_win(unlisted_buf, true, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts) + local unlisted_buf = api.nvim_create_buf(true, false) + unlisted_buf_float = api.nvim_open_win(unlisted_buf, true, float_opts) insert('unlisted') command('set nobuflisted') - meths.set_current_win(old_win) + api.nvim_set_current_win(old_win) end) after_each(function() expect('') - eq(2, #meths.list_wins()) + eq(2, #api.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.buf_delete(old_buf, {force = true}) - eq(old_win, curwin().id) + api.nvim_buf_delete(old_buf, {force = true}) + eq(old_win, curwin()) end) it('if called from floating window with the same buffer', function() - meths.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.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) + eq(old_win, curwin()) end) -- TODO: this case is too hard to deal with pending('if called from floating window with an unlisted buffer', function() - meths.set_current_win(unlisted_buf_float) - meths.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,21 +669,21 @@ describe('float window', function() command('botright vnew') insert('unlisted') command('set nobuflisted') - meths.set_current_win(old_win) - same_buf_float = meths.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) end) after_each(function() expect('') - eq(2, #meths.list_wins()) + eq(2, #api.nvim_list_wins()) end) it('if called from non-floating window with the deleted buffer', function() - meths.buf_delete(old_buf, {force = true}) - eq(old_win, curwin().id) + api.nvim_buf_delete(old_buf, {force = true}) + eq(old_win, curwin()) end) it('if called from floating window with the deleted buffer', function() - meths.set_current_win(same_buf_float) - meths.buf_delete(old_buf, {force = true}) - eq(same_buf_float, curwin().id) + api.nvim_set_current_win(same_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) + eq(same_buf_float, curwin()) end) end) end) @@ -688,63 +695,63 @@ describe('float window', function() before_each(function() insert('unlisted') command('set nobuflisted') - unlisted_buf = curbuf().id + unlisted_buf = curbuf() command('tabnew') insert('foo') - old_buf = curbuf().id - old_win = curwin().id + old_buf = curbuf() + old_win = curwin() end) describe('without splits, deleting the last listed buffer creates an empty buffer', function() local same_buf_float before_each(function() - meths.set_current_win(old_win) - same_buf_float = meths.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) end) after_each(function() expect('') - eq(2, #meths.list_wins()) - eq(2, #meths.list_tabpages()) + eq(2, #api.nvim_list_wins()) + eq(2, #api.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.buf_delete(old_buf, {force = true}) - eq(old_win, curwin().id) + api.nvim_buf_delete(old_buf, {force = true}) + eq(old_win, curwin()) end) it('if called from non-floating window in another tabpage', function() command('tab split') - eq(3, #meths.list_tabpages()) - meths.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.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.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) + eq(old_win, curwin()) end) end) describe('with splits, deleting the last listed buffer creates an empty buffer', function() local same_buf_float before_each(function() command('botright vsplit') - meths.set_current_buf(unlisted_buf) - meths.set_current_win(old_win) - same_buf_float = meths.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) end) after_each(function() expect('') - eq(3, #meths.list_wins()) - eq(2, #meths.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.buf_delete(old_buf, {force = true}) - eq(old_win, curwin().id) + api.nvim_buf_delete(old_buf, {force = true}) + eq(old_win, curwin()) end) it('if called from floating window with the deleted buffer', function() - meths.set_current_win(same_buf_float) - meths.buf_delete(old_buf, {force = true}) - eq(same_buf_float, curwin().id) + api.nvim_set_current_win(same_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) + eq(same_buf_float, curwin()) end) end) end) @@ -753,48 +760,48 @@ describe('float window', function() local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1} local old_tabpage, old_buf, old_win before_each(function() - old_tabpage = curtab().id + old_tabpage = curtab() insert('oldtab') command('tabnew') - old_buf = curbuf().id - old_win = curwin().id + old_buf = curbuf() + old_win = curwin() end) describe('closing the last non-floating window', function() describe('closes the tabpage when all floating windows are closeable', function() local same_buf_float before_each(function() - same_buf_float = meths.open_win(old_buf, false, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts) end) after_each(function() - eq(old_tabpage, curtab().id) + eq(old_tabpage, curtab()) expect('oldtab') - eq(1, #meths.list_tabpages()) + eq(1, #api.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.win_close(old_win, false) + api.nvim_win_close(old_win, false) end) it('if called from floating window', function() - meths.set_current_win(same_buf_float) - meths.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.create_buf(true, false).id - other_buf_float = meths.open_win(other_buf, true, float_opts).id + local other_buf = api.nvim_create_buf(true, false) + other_buf_float = api.nvim_open_win(other_buf, true, float_opts) insert('foo') - meths.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.win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) it('if called from floating window', function() - meths.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.win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) end) end) @@ -802,27 +809,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.open_win(old_buf, false, float_opts).id - other_buf = meths.create_buf(true, false).id - other_buf_float = meths.open_win(other_buf, true, float_opts).id - meths.set_current_win(old_win) + same_buf_float = api.nvim_open_win(old_buf, false, float_opts) + other_buf = api.nvim_create_buf(true, false) + other_buf_float = api.nvim_open_win(other_buf, true, float_opts) + api.nvim_set_current_win(old_win) end) after_each(function() - eq(old_tabpage, curtab().id) + eq(old_tabpage, curtab()) expect('oldtab') - eq(1, #meths.list_tabpages()) + eq(1, #api.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.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.set_current_win(same_buf_float) - meths.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.set_current_win(other_buf_float) - meths.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? @@ -862,36 +869,27 @@ describe('float window', function() [24] = {foreground = Screen.colors.Black, background = Screen.colors.Grey80}; [25] = {blend = 100, background = Screen.colors.Gray0}; [26] = {blend = 80, background = Screen.colors.Gray0}; - [27] = {background = Screen.colors.LightGray}; - [28] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGray}; + [27] = {foreground = Screen.colors.Black, background = Screen.colors.LightGrey}; + [28] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}; } screen:set_default_attr_ids(attrs) end) it('can be created and reconfigured', function() - local buf = meths.create_buf(false,false) - local win = meths.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}, + [4]={1001, 'NW', 1, 2, 5, true}, } if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -904,33 +902,23 @@ describe('float window', function() {0:~ }| {0:~ }{1: }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end - meths.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 screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -941,43 +929,27 @@ describe('float window', function() screen:expect([[ ^ {1: } | {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]) end - meths.win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ]]) else screen:expect([[ ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end @@ -985,39 +957,29 @@ describe('float window', function() it('window position fixed', function() command('rightbelow 20vsplit') - local buf = meths.create_buf(false,false) - local win = meths.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 screen:expect{grid=[[ ## grid 1 - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| + [2:-------------------]{5:│}[4:--------------------]|*5 {5:[No Name] }{4:[No Name] }| [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 5 {1: }| {2:~ }| ]], float_pos={ - [5] = {{id = 1002}, "NW", 4, 2, 10, true}; + [5] = {1002, "NW", 4, 2, 10, true}; }} else screen:expect([[ @@ -1031,7 +993,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {fixed=false}) + api.nvim_win_set_config(win, {fixed=false}) if multigrid then screen:expect_unchanged() @@ -1055,29 +1017,20 @@ describe('float window', function() -- or something. command("set redrawdebug=compositor") command("set wd=1") - local buf = meths.create_buf(false,false) - local win = meths.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}, + [4]={1001, 'NW', 1, 2, 5, true}, } if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -1090,33 +1043,23 @@ describe('float window', function() {0:~ }| {0:~ }{1: }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end - meths.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 screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -1127,84 +1070,70 @@ describe('float window', function() screen:expect([[ ^ {1: } | {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]) end - meths.win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ]]) else screen:expect([[ ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end end) it('return their configuration', function() - local buf = meths.create_buf(false, false) - local win = meths.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.win_get_config(win)) + eq(expected, api.nvim_win_get_config(win)) + eq(true, exec_lua([[ + local expected, win = ... + local actual = vim.api.nvim_win_get_config(win) + for k,v in pairs(expected) do + if v ~= actual[k] then + error(k) + end + end + return true]], expected, win)) - eq({relative='', external=false, focusable=true, hide=false}, meths.win_get_config(0)) + eq({external=false, focusable=true, hide=false, relative='',split="left",width=40,height=6}, api.nvim_win_get_config(0)) if multigrid then - meths.win_set_config(win, {external=true, width=10, height=1}) - eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, meths.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) it('defaults to NormalFloat highlight and inherited options', function() command('set number') - command('hi NormalFloat guibg=#333333') + command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ix<cr>y<cr><esc>gg') - local win = meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 {14: 1 }^x | {14: 2 }y | {14: 3 } | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 @@ -1212,7 +1141,7 @@ describe('float window', function() {18: 2 }{15:y }| {18: 3 }{15: }| {16:~ }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} else screen:expect([[ {14: 1 }^x | @@ -1225,41 +1154,30 @@ describe('float window', function() ]]) end - local buf = meths.create_buf(false, true) - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 {14: 1 }^x | {14: 2 }y | {14: 3 } | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 {18: 1 }{15: }| - {16:~ }| - {16:~ }| - {16:~ }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + {16:~ }|*3 + ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} else screen:expect([[ {14: 1 }^x | {14: 2 }y | {14: 3 } {18: 1 }{15: } | - {0:~ }{16:~ }{0: }| - {0:~ }{16:~ }{0: }| - {0:~ }{16:~ }{0: }| + {0:~ }{16:~ }{0: }|*3 | ]]) end @@ -1271,42 +1189,33 @@ describe('float window', function() command('set colorcolumn=1') command('set cursorline') command('set foldcolumn=1') - command('hi NormalFloat guibg=#333333') + command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ix<cr>y<cr><esc>gg') - local win = meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 {19: }{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 {15:x }| {15:y }| - {15: }| - {15: }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + {15: }|*2 + ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} else screen:expect{grid=[[ {19: }{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } {15:x } | {0:~ }{15:y }{0: }| - {0:~ }{15: }{0: }| - {0:~ }{15: }{0: }| + {0:~ }{15: }{0: }|*2 | ]]} end @@ -1317,20 +1226,13 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 {19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 @@ -1338,7 +1240,7 @@ describe('float window', function() {19: }{15:y }| {19: }{15: }| {15: }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} else screen:expect([[ @@ -1353,41 +1255,29 @@ describe('float window', function() end command('sign unplace 1 buffer=1') - local buf = meths.create_buf(false, true) - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 {19: }{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 - {15: }| - {15: }| - {15: }| - {15: }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + {15: }|*4 + ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} else screen:expect([[ {19: }{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } {15: } | - {0:~ }{15: }{0: }| - {0:~ }{15: }{0: }| - {0:~ }{15: }{0: }| + {0:~ }{15: }{0: }|*3 | ]]) end @@ -1399,42 +1289,33 @@ describe('float window', function() command('set colorcolumn=1') command('set cursorline') command('set foldcolumn=1') - command('hi NormalFloat guibg=#333333') + command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ix<cr>y<cr><esc>gg') - local win = meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 {19: }{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 {15:x }| {15:y }| - {15: }| - {15: }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + {15: }|*2 + ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} else screen:expect{grid=[[ {19: }{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } {15:x } | {0:~ }{15:y }{0: }| - {0:~ }{15: }{0: }| - {0:~ }{15: }{0: }| + {0:~ }{15: }{0: }|*2 | ]]} end @@ -1445,20 +1326,13 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 {19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 @@ -1466,7 +1340,7 @@ describe('float window', function() {19: }{15:y }| {19: }{15: }| {15: }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} else screen:expect([[ @@ -1481,41 +1355,29 @@ describe('float window', function() end command('sign unplace 1 buffer=1') - local buf = meths.create_buf(false, true) - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 {19: }{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 - {15: }| - {15: }| - {15: }| - {15: }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + {15: }|*4 + ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} else screen:expect([[ {19: }{20: 1 }{22:^x}{21: }| {19: }{14: 2 }{22:y} | {19: }{14: 3 }{22: } {15: } | - {0:~ }{15: }{0: }| - {0:~ }{15: }{0: }| - {0:~ }{15: }{0: }| + {0:~ }{15: }{0: }|*3 | ]]) end @@ -1528,70 +1390,52 @@ describe('float window', function() command('set cursorline') command('set foldcolumn=1') command('set statuscolumn=%l%s%C') - command('hi NormalFloat guibg=#333333') + command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ix<cr>y<cr><esc>gg') - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 {20:1}{19: }{20: }{22:^x}{21: }| {14:2}{19: }{14: }{22:y} | {14:3}{19: }{14: }{22: } | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 {15:x }| {15:y }| - {15: }| - {15: }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + {15: }|*2 + ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} else screen:expect{grid=[[ {20:1}{19: }{20: }{22:^x}{21: }| {14:2}{19: }{14: }{22:y} | {14:3}{19: }{14: }{22: } {15:x } | {0:~ }{15:y }{0: }| - {0:~ }{15: }{0: }| - {0:~ }{15: }{0: }| + {0:~ }{15: }{0: }|*2 | ]]} end end) it('can have border', function() - local buf = meths.create_buf(false, false) - meths.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.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=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -1600,10 +1444,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1617,24 +1461,15 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border="single"}) + api.nvim_win_set_config(win, {border="single"}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -1643,10 +1478,10 @@ describe('float window', function() {5:│}{1: BORDAA }{5:│}| {5:└─────────┘}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1660,24 +1495,15 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border="rounded"}) + api.nvim_win_set_config(win, {border="rounded"}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -1686,10 +1512,10 @@ describe('float window', function() {5:│}{1: BORDAA }{5:│}| {5:╰─────────╯}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1703,24 +1529,15 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border="solid"}) + api.nvim_win_set_config(win, {border="solid"}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -1729,10 +1546,10 @@ describe('float window', function() {5: }{1: BORDAA }{5: }| {5: }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1747,24 +1564,15 @@ describe('float window', function() end -- support: ascii char, UTF-8 char, composed char, highlight per char - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -1773,10 +1581,10 @@ describe('float window', function() {17:n̈̊}{1: BORDAA }{17:n̈̊}| {5:\}{7:ååååååååå}{5:x}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1790,34 +1598,25 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border="none"}) + api.nvim_win_set_config(win, {border="none"}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {1: halloj! }| {1: BORDAA }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1825,40 +1624,30 @@ describe('float window', function() {0:~ }| {0:~ }{1: halloj! }{0: }| {0:~ }{1: BORDAA }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]} end - meths.win_set_config(win, {border={"", "", "", ">", "", "", "", "<"}}) + api.nvim_win_set_config(win, {border={"", "", "", ">", "", "", "", "<"}}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {5:<}{1: halloj! }{5:>}| {5:<}{1: BORDAA }{5:>}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1866,30 +1655,20 @@ describe('float window', function() {0:~ }| {0:~ }{5:<}{1: halloj! }{5:>}{0: }| {0:~ }{5:<}{1: BORDAA }{5:>}{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]} end - meths.win_set_config(win, {border={"", "_", "", "", "", "-", "", ""}}) + api.nvim_win_set_config(win, {border={"", "_", "", "", "", "-", "", ""}}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -1898,10 +1677,10 @@ describe('float window', function() {1: BORDAA }| {5:---------}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1923,16 +1702,11 @@ describe('float window', function() of border shadow ]] - meths.win_set_config(win, {border="shadow"}) + api.nvim_win_set_config(win, {border="shadow"}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 neeed some dummy | @@ -1948,10 +1722,10 @@ describe('float window', function() {1: BORDAA }{26: }| {25: }{26: }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0, linecount = 6, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 6, curline = 5, curcol = 0, linecount = 6, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1967,13 +1741,13 @@ describe('float window', function() end) it('validates title title_pos', function() - local buf = meths.create_buf(false,false) + local buf = api.nvim_create_buf(false,false) eq("title requires border to be set", - pcall_err(meths.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.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', })) @@ -2001,13 +1775,13 @@ describe('float window', function() end) it('validates footer footer_pos', function() - local buf = meths.create_buf(false,false) + local buf = api.nvim_create_buf(false,false) eq("footer requires border to be set", - pcall_err(meths.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.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', })) @@ -2035,10 +1809,10 @@ describe('float window', function() end) it('center aligned title longer than window width #25746', function() - local buf = meths.create_buf(false, false) - meths.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.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", }) @@ -2046,20 +1820,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2068,10 +1833,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2085,15 +1850,15 @@ describe('float window', function() ]]} end - meths.win_close(win, false) + api.nvim_win_close(win, false) assert_alive() end) it('border with title', function() - local buf = meths.create_buf(false, false) - meths.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.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", }) @@ -2101,20 +1866,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2123,10 +1879,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2140,24 +1896,15 @@ describe('float window', function() ]]} end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2166,10 +1913,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2183,24 +1930,15 @@ describe('float window', function() ]]} end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2209,10 +1947,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2226,24 +1964,15 @@ describe('float window', function() ]]} end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2252,10 +1981,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2271,10 +2000,10 @@ describe('float window', function() end) it('border with footer', function() - local buf = meths.create_buf(false, false) - meths.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.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", }) @@ -2282,20 +2011,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2304,10 +2024,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚}{11:Left}{5:═════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2321,24 +2041,15 @@ describe('float window', function() ]]} end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2347,10 +2058,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═}{11:Center}{5:══╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2364,24 +2075,15 @@ describe('float window', function() ]]} end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2390,10 +2092,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚════}{11:Right}{5:╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2407,24 +2109,15 @@ describe('float window', function() ]]} end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2433,10 +2126,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═════}🦄BB{5:╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2452,10 +2145,10 @@ describe('float window', function() end) it('border with title and footer', function() - local buf = meths.create_buf(false, false) - meths.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.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", }) @@ -2463,20 +2156,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2485,10 +2169,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚════}{11:Right}{5:╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2502,24 +2186,15 @@ describe('float window', function() ]]} end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2528,10 +2203,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═}{11:Center}{5:══╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2545,24 +2220,15 @@ describe('float window', function() ]]} end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2571,10 +2237,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚}{11:Left}{5:═════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2590,27 +2256,18 @@ describe('float window', function() command('hi B0 guibg=Red guifg=Black') command('hi B1 guifg=White') - meths.win_set_config(win, { + api.nvim_win_set_config(win, { title = {{"🦄"}, {"BB", {"B0", "B1"}}}, title_pos = "right", footer= {{"🦄"}, {"BB", {"B0", "B1"}}}, footer_pos = "right", }) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -2619,10 +2276,10 @@ describe('float window', function() {5:║}{1: BORDAA }{5:║}| {5:╚═════}🦄{7:BB}{5:╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true } + [4] = { 1001, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2638,51 +2295,34 @@ describe('float window', function() end) it('terminates border on edge of viewport when window extends past viewport', function() - local buf = meths.create_buf(false, false) - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {5:┌────────────────────────────────────────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*6 {5:└────────────────────────────────────────┘}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 0, 0, true, 201 } + [4] = { 1001, "NW", 1, 0, 0, true, 201 } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ {5:^┌──────────────────────────────────────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*4 {5:└──────────────────────────────────────┘}| ]]} end @@ -2690,35 +2330,20 @@ describe('float window', function() it('with border show popupmenu', function() screen:try_resize(40,10) - local buf = meths.create_buf(false, false) - meths.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.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 screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*9 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ## grid 3 | ## grid 4 @@ -2728,10 +2353,10 @@ describe('float window', function() {5:║}{1:^ }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 0, 5, true }; + [4] = { 1001, "NW", 1, 0, 5, true }; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2740,10 +2365,7 @@ describe('float window', function() {0:~ }{5:║}{1:abb acc }{5:║}{0: }| {0:~ }{5:║}{1:^ }{5:║}{0: }| {0:~ }{5:╚═════════╝}{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]} end @@ -2752,26 +2374,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*9 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ## grid 3 {3:-- }{8:match 1 of 4} | ## grid 4 @@ -2786,11 +2393,11 @@ describe('float window', function() {1: abb }| {13: acc }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 0, 5, true, 50 }; - [5] = { { id = -1 }, "NW", 4, 4, 0, false, 100 }; + [4] = { 1001, "NW", 1, 0, 5, true, 50 }; + [5] = { -1, "NW", 4, 4, 0, false, 100 }; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2811,26 +2418,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*9 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ## grid 3 | ## grid 4 @@ -2840,10 +2432,10 @@ describe('float window', function() {5:║}{1:ac^c }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 0, 5, true }; + [4] = { 1001, "NW", 1, 0, 5, true }; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2852,10 +2444,7 @@ describe('float window', function() {0:~ }{5:║}{1:abb acc }{5:║}{0: }| {0:~ }{5:║}{1:ac^c }{5:║}{0: }| {0:~ }{5:╚═════════╝}{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]} end @@ -2869,26 +2458,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*9 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ## grid 3 :popup Test | ## grid 4 @@ -2902,11 +2476,11 @@ describe('float window', function() {1: bar }| {1: baz }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 0, 5, true }; - [5] = { { id = -1 }, "NW", 4, 4, 2, false, 250 }; + [4] = { 1001, "NW", 1, 0, 5, true }; + [5] = { -1, "NW", 4, 4, 2, false, 250 }; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2917,8 +2491,7 @@ describe('float window', function() {0:~ }{5:╚═}{1: foo }{5:═══╝}{0: }| {0:~ }{1: bar }{0: }| {0:~ }{1: baz }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 :popup Test | ]]} end @@ -2926,29 +2499,20 @@ describe('float window', function() it('show ruler of current floating window', function() command 'set ruler' - local buf = meths.create_buf(false, false) - meths.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.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 screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 1,1 All | ## grid 4 @@ -2956,19 +2520,17 @@ describe('float window', function() {1:abb acc }| {2:~ }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ {1:^aaa aab } | {0:~ }{1:abb acc }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 1,1 All | ]]} end @@ -2977,20 +2539,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 1,5 All | ## grid 4 @@ -2998,19 +2551,17 @@ describe('float window', function() {1:abb acc }| {2:~ }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 4, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 4, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ {1:aaa ^aab } | {0:~ }{1:abb acc }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 1,5 All | ]]} end @@ -3018,44 +2569,31 @@ describe('float window', function() it("correct ruler position in current float with 'rulerformat' set", function() command 'set ruler rulerformat=fish:<><' - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 fish:<>< | ## grid 4 {1:^ }| - {2:~ }| - {2:~ }| + {2:~ }|*2 ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ {1:^ } | - {0:~ }{2:~ }{0: }| - {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }{2:~ }{0: }|*2 + {0:~ }|*3 fish:<>< | ]]} end @@ -3064,60 +2602,40 @@ 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.open_win(0, false, {relative='editor', width=3, height=3, row=0, col=0}) - meths.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 '<c-w>w' - neq('', meths.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 - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| + [2:--------------------------------------------------]|*8 [3:--------------------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*7 ## grid 3 0,0-1 All | ## grid 4 {1: }| - {2:~ }| - {2:~ }| + {2:~ }|*2 ## grid 5 {1:^ }| - {2:~ }| - {2:~ }| + {2:~ }|*2 ]], float_pos={ - [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50}; - [4] = {{id = 1001}, "NW", 1, 0, 0, true, 50}; + [5] = {1002, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 0, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = 1002, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ {1: } {1:^ } | - {2:~ }{0: }{2:~ }{0: }| - {2:~ }{0: }{2:~ }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {2:~ }{0: }{2:~ }{0: }|*2 + {0:~ }|*5 0,0-1 All | ]]} end @@ -3125,52 +2643,32 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| + [2:--------------------------------------------------]|*8 [3:--------------------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*7 ## grid 3 {3:-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)} | ## grid 4 {1: }| - {2:~ }| - {2:~ }| + {2:~ }|*2 ## grid 5 {1:^ }| - {2:~ }| - {2:~ }| + {2:~ }|*2 ]], float_pos={ - [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50}; - [4] = {{id = 1001}, "NW", 1, 0, 0, true, 50}; + [5] = {1002, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 0, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = 1002, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ {1: } {1:^ } | - {2:~ }{0: }{2:~ }{0: }| - {2:~ }{0: }{2:~ }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {2:~ }{0: }{2:~ }{0: }|*2 + {0:~ }|*5 {3:-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)} | ]]} end @@ -3178,111 +2676,72 @@ describe('float window', function() it('can have minimum size', function() insert("the background text") - local buf = meths.create_buf(false, true) - meths.buf_set_lines(buf, 0, -1, true, {'x'}) - local win = meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 the background tex^t | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {1:x}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 2, 0, 4, false} + [4] = {1001, "NW", 2, 0, 4, false} }} else screen:expect([[ the {1:x}ackground tex^t | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 the background tex^t | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {1:x}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 2, 0, 15, false} + [4] = {1001, "NW", 2, 0, 15, false} }} else screen:expect([[ the background {1:x}ex^t | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end - meths.win_close(win,false) + api.nvim_win_close(win,false) if multigrid then screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 the background tex^t | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ]]) else screen:expect([[ the background tex^t | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end @@ -3303,23 +2762,19 @@ describe('float window', function() command('sargument 6') local float_opts = { relative = 'editor', row = 6, col = 0, width = 40, height = 1 } - meths.win_set_config(w3, float_opts) - meths.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=[[ ## grid 1 - [8:----------------------------------------]| - [8:----------------------------------------]| + [8:----------------------------------------]|*2 {4:X6 }| - [7:----------------------------------------]| - [7:----------------------------------------]| + [7:----------------------------------------]|*2 {5:X5 }| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*2 {5:X2 }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:X1 }| [3:----------------------------------------]| ## grid 2 @@ -3341,15 +2796,15 @@ describe('float window', function() ^ | {0:~ }| ]], float_pos={ - [5] = {{id = 1002}, "NW", 1, 6, 0, true, 50}; - [6] = {{id = 1003}, "NW", 1, 6, 0, true, 50}; + [5] = {1002, "NW", 1, 6, 0, true, 50}; + [6] = {1003, "NW", 1, 6, 0, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [6] = {win = {id = 1003}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [7] = {win = {id = 1004}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [8] = {win = {id = 1005}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = 1002, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [6] = {win = 1003, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [7] = {win = 1004, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [8] = {win = 1005, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -3401,12 +2856,12 @@ describe('float window', function() ## grid 10 | ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [7] = {win = {id = 1004}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [8] = {win = {id = 1005}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [9] = {win = {id = 1006}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [10] = {win = {id = 1007}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [7] = {win = 1004, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [8] = {win = 1005, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [9] = {win = 1006, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [10] = {win = 1007, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -3437,47 +2892,47 @@ describe('float window', function() end) it('API has proper error messages', function() - local buf = meths.create_buf(false,false) + local buf = api.nvim_create_buf(false,false) eq("Invalid key: 'bork'", - pcall_err(meths.open_win,buf, false, {width=20,height=2,bork=true})) - eq("'win' key is only valid with relative='win'", - pcall_err(meths.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,bork=true})) + eq("'win' key is only valid with relative='win' and relative=''", + pcall_err(api.nvim_open_win, buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0})) + eq("floating windows cannot have 'vertical'", + pcall_err(api.nvim_open_win, buf, false, {width=20,height=2,relative='editor',row=0,col=0,vertical=true})) + eq("floating windows cannot have 'split'", + pcall_err(api.nvim_open_win, buf, false, {width=20,height=2,relative='editor',row=0,col=0,split="left"})) eq("Only one of 'relative' and 'external' must be used", - pcall_err(meths.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.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.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.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.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.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.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.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.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.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.get_current_win() + local oldwin = api.nvim_get_current_win() command('below split') if multigrid then screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*3 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*3 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -3505,19 +2960,15 @@ describe('float window', function() ]]) end - local buf = meths.create_buf(false,false) + local buf = api.nvim_create_buf(false,false) -- no 'win' arg, relative default window - local win = meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*3 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*3 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -3534,7 +2985,7 @@ describe('float window', function() {1: }| {2:~ }| ]], float_pos={ - [5] = {{id = 1002}, "NW", 4, 0, 10, true} + [5] = {1002, "NW", 4, 0, 10, true} }} else screen:expect([[ @@ -3550,17 +3001,13 @@ describe('float window', function() ]]) end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*3 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*3 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -3577,7 +3024,7 @@ describe('float window', function() {1: }| {2:~ }| ]], float_pos={ - [5] = {{id = 1002}, "NW", 4, 1, 1, true} + [5] = {1002, "NW", 4, 1, 1, true} }} else screen:expect([[ @@ -3593,17 +3040,13 @@ describe('float window', function() ]]) end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*3 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*3 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -3620,7 +3063,7 @@ describe('float window', function() {1: }| {2:~ }| ]], float_pos={ - [5] = {{id = 1002}, "SW", 4, 0, 3, true} + [5] = {1002, "SW", 4, 0, 3, true} }} else screen:expect([[ @@ -3636,17 +3079,13 @@ describe('float window', function() ]]) end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*3 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*3 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -3663,7 +3102,7 @@ describe('float window', function() {1: }| {2:~ }| ]], float_pos={ - [5] = {{id = 1002}, "NW", 2, 1, 10, true} + [5] = {1002, "NW", 2, 1, 10, true} }} else screen:expect([[ @@ -3679,17 +3118,13 @@ describe('float window', function() ]]) end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*3 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*3 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -3706,7 +3141,7 @@ describe('float window', function() {1: }| {2:~ }| ]], float_pos={ - [5] = {{id = 1002}, "SE", 2, 3, 39, true} + [5] = {1002, "SE", 2, 3, 39, true} }} else screen:expect([[ @@ -3722,17 +3157,13 @@ describe('float window', function() ]]) end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*3 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*3 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -3749,7 +3180,7 @@ describe('float window', function() {1: }| {2:~ }| ]], float_pos={ - [5] = {{id = 1002}, "NE", 4, 0, 50, true} + [5] = {1002, "NE", 4, 0, 50, true} }, win_viewport = { [2] = { topline = 0, @@ -3758,7 +3189,7 @@ describe('float window', function() curcol = 3, linecount = 2, sum_scroll_delta = 0, - win = { id = 1000 }, + win = 1000, }, [4] = { topline = 0, @@ -3767,7 +3198,7 @@ describe('float window', function() curcol = 3, linecount = 2, sum_scroll_delta = 0, - win = { id = 1001 } + win = 1001 }, [5] = { topline = 0, @@ -3776,7 +3207,7 @@ describe('float window', function() curcol = 0, linecount = 1, sum_scroll_delta = 0, - win = { id = 1002 } + win = 1002 } }} else @@ -3796,108 +3227,78 @@ describe('float window', function() it('always anchor to corner including border', function() screen:try_resize(40,13) - meths.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 screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*5 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 just some example text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 just some exampl^e text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ]]) else screen:expect([[ just some example text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {5:[No Name] [+] }| just some exampl^e text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {4:[No Name] [+] }| | ]]) end - local buf = meths.create_buf(false, false) - meths.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.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=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*5 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 just some example text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 just some exampl^e text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 5 {5:╔═════════╗}| {5:║}{1: halloj! }{5:║}| {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [5] = {{id = 1002}, "NW", 4, 1, 14, true} + [5] = {1002, "NW", 4, 1, 14, true} }} else screen:expect([[ just some example text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {5:[No Name] [+] }| just some exampl^e text | some more exam{5:╔═════════╗} | @@ -3909,52 +3310,38 @@ describe('float window', function() ]]) end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*5 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 just some example text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 just some exampl^e text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 5 {5:╔═════════╗}| {5:║}{1: halloj! }{5:║}| {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [5] = {{id = 1002}, "NE", 4, 0, 14, true} + [5] = {1002, "NE", 4, 0, 14, true} }} else screen:expect([[ just some example text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {5:[No Name] [+] }| jus{5:╔═════════╗}pl^e text | som{5:║}{1: halloj! }{5:║}ple text | @@ -3966,44 +3353,32 @@ describe('float window', function() ]]) end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*5 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 just some example text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 just some exampl^e text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 5 {5:╔═════════╗}| {5:║}{1: halloj! }{5:║}| {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [5] = {{id = 1002}, "SE", 4, 1, 14, true} + [5] = {1002, "SE", 4, 1, 14, true} }} else screen:expect([[ @@ -4015,52 +3390,38 @@ describe('float window', function() {5:[No║}{1: BORDAA }{5:║ }| jus{5:╚═════════╝}pl^e text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {4:[No Name] [+] }| | ]]) end - meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*5 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 just some example text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 just some exampl^e text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 5 {5:╔═════════╗}| {5:║}{1: halloj! }{5:║}| {5:║}{1: BORDAA }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [5] = {{id = 1002}, "SW", 4, 0, 14, true} + [5] = {1002, "SW", 4, 0, 14, true} }} else screen:expect([[ @@ -4072,9 +3433,7 @@ describe('float window', function() {5:[No Name] [+] ╚═════════╝ }| just some exampl^e text | some more example text | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {4:[No Name] [+] }| | ]]) @@ -4121,20 +3480,12 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 - | - | - | + |*3 ^ | - {0:~ }| - {0:~ }| + {0:~ }|*2 ## grid 3 | ## grid 5 @@ -4154,14 +3505,14 @@ describe('float window', function() ## grid 12 {1:8 }| ]], float_pos={ - [5] = {{id = 1002}, "NW", 1, 1, 10, true, 50}; - [6] = {{id = 1003}, "NW", 1, 1, 30, true, 50}; - [7] = {{id = 1004}, "NE", 5, 1, 0, true, 50}; - [8] = {{id = 1005}, "NE", 6, 1, 0, true, 50}; - [9] = {{id = 1006}, "SE", 7, 0, 0, true, 50}; - [10] = {{id = 1007}, "SE", 8, 0, 0, true, 50}; - [11] = {{id = 1008}, "SW", 9, 0, 5, true, 50}; - [12] = {{id = 1009}, "SW", 10, 0, 5, true, 50}; + [5] = {1002, "NW", 1, 1, 10, true, 50}; + [6] = {1003, "NW", 1, 1, 30, true, 50}; + [7] = {1004, "NE", 5, 1, 0, true, 50}; + [8] = {1005, "NE", 6, 1, 0, true, 50}; + [9] = {1006, "SE", 7, 0, 0, true, 50}; + [10] = {1007, "SE", 8, 0, 0, true, 50}; + [11] = {1008, "SW", 9, 0, 5, true, 50}; + [12] = {1009, "SW", 10, 0, 5, true, 50}; }} else screen:expect([[ @@ -4169,8 +3520,7 @@ describe('float window', function() {1:5 } {1:1 } {1:6 } {1:2 } | {1:3 } {1:4 } | ^ | - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -4197,20 +3547,12 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 - | - | - | + |*3 ^ | - {0:~ }| - {0:~ }| + {0:~ }|*2 ## grid 3 | ## grid 5 @@ -4230,14 +3572,14 @@ describe('float window', function() ## grid 12 {1:8 }| ]], float_pos={ - [5] = {{id = 1002}, "NE", 8, 1, 0, true, 50}; - [6] = {{id = 1003}, "NE", 12, 1, 0, true, 50}; - [7] = {{id = 1004}, "SE", 5, 0, 0, true, 50}; - [8] = {{id = 1005}, "NW", 1, 1, 30, true, 50}; - [9] = {{id = 1006}, "SW", 10, 0, 5, true, 50}; - [10] = {{id = 1007}, "SE", 6, 0, 0, true, 50}; - [11] = {{id = 1008}, "SW", 7, 0, 5, true, 50}; - [12] = {{id = 1009}, "NW", 1, 1, 10, true, 50}; + [5] = {1002, "NE", 8, 1, 0, true, 50}; + [6] = {1003, "NE", 12, 1, 0, true, 50}; + [7] = {1004, "SE", 5, 0, 0, true, 50}; + [8] = {1005, "NW", 1, 1, 30, true, 50}; + [9] = {1006, "SW", 10, 0, 5, true, 50}; + [10] = {1007, "SE", 6, 0, 0, true, 50}; + [11] = {1008, "SW", 7, 0, 5, true, 50}; + [12] = {1009, "NW", 1, 1, 10, true, 50}; }} else screen:expect([[ @@ -4245,8 +3587,7 @@ describe('float window', function() {1:6 } {1:8 } {1:3 } {1:4 } | {1:2 } {1:1 } | ^ | - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -4275,15 +3616,12 @@ describe('float window', function() it('can be placed relative text in a window', function() screen:try_resize(30,5) - local firstwin = meths.get_current_win().id - meths.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() + 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 - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| + [2:------------------------------]|*4 [3:------------------------------]| ## grid 2 ^just some | @@ -4298,22 +3636,18 @@ describe('float window', function() ^just some | example text that is wider tha| n the window | - | - | + |*2 ]]} end - local buf = meths.create_buf(false,false) - meths.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.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 - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| + [2:------------------------------]|*4 [3:------------------------------]| ## grid 2 ^just some | @@ -4325,7 +3659,7 @@ describe('float window', function() ## grid 4 {1:some info! }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 2, 3, 2, true } + [4] = { 1001, "NW", 2, 3, 2, true } }} else screen:expect{grid=[[ @@ -4337,36 +3671,31 @@ 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.win_get_config(win)) + external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, api.nvim_win_get_config(win)) feed('<c-e>') if multigrid then screen:expect{grid=[[ ## grid 1 - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| + [2:------------------------------]|*4 [3:------------------------------]| ## grid 2 ^example text that is wider tha| n the window | - | - | + |*2 ## grid 3 | ## grid 4 {1:some info! }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 2, 2, 2, true }, + [4] = { 1001, "NW", 2, 2, 2, true }, }} else screen:expect{grid=[[ ^example text that is wider tha| n the window | {1:some info! } | - | - | + |*2 ]]} end @@ -4375,22 +3704,18 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:---------------------------------------------]| - [2:---------------------------------------------]| - [2:---------------------------------------------]| - [2:---------------------------------------------]| + [2:---------------------------------------------]|*4 [3:---------------------------------------------]| ## grid 2 ^example text that is wider than the window | - | - | + |*2 more text | ## grid 3 | ## grid 4 {1:some info! }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 2, 1, 32, true } + [4] = { 1001, "NW", 2, 1, 32, true } }} else -- note: appears misaligned due to cursor @@ -4407,32 +3732,20 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| + [2:-------------------------]|*9 [3:-------------------------]| ## grid 2 ^example text that is wide| r than the window | - | - | + |*2 more text | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 {1:some info! }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 2, 2, 7, true } + [4] = { 1001, "NW", 2, 2, 7, true } }} else screen:expect{grid=[[ @@ -4441,56 +3754,37 @@ describe('float window', function() {1:some info! } | | more text | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]} end - meths.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 - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| + [2:-------------------------]|*9 [3:-------------------------]| ## grid 2 ^example text that is wide| r than the window | - | - | + |*2 more text | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 {1:some info! }| ]], float_pos={ - [4] = { { id = 1001 }, "SW", 2, 1, 7, true } + [4] = { 1001, "SW", 2, 1, 7, true } }} else screen:expect{grid=[[ ^example{1:some info! }s wide| r than the window | - | - | + |*2 more text | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]} end @@ -4500,15 +3794,7 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----]{5:│}[5:--------------------]| - [2:----]{5:│}[5:--------------------]| - [2:----]{5:│}[5:--------------------]| - [2:----]{5:│}[5:--------------------]| - [2:----]{5:│}[5:--------------------]| - [2:----]{5:│}[5:--------------------]| - [2:----]{5:│}[5:--------------------]| - [2:----]{5:│}[5:--------------------]| - [2:----]{5:│}[5:--------------------]| + [2:----]{5:│}[5:--------------------]|*9 [3:-------------------------]| ## grid 2 exam| @@ -4526,16 +3812,9 @@ describe('float window', function() {1:some info! }| ## grid 5 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ]], float_pos={ - [4] = { { id = 1001 }, "SW", 2, 8, 0, true } + [4] = { 1001, "SW", 2, 8, 0, true } }} else screen:expect{grid=[[ @@ -4553,36 +3832,24 @@ describe('float window', function() end command('close') - meths.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 - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| + [2:-------------------------]|*9 [3:-------------------------]| ## grid 2 ^example text that is wide| r than the window | - | - | + |*2 more text | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 {1:some info! }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 2, 2, 5, true } + [4] = { 1001, "NW", 2, 2, 5, true } }} else screen:expect{grid=[[ @@ -4591,44 +3858,29 @@ describe('float window', function() {1:some info! } | | more text | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]} end - meths.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 - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| + [2:-------------------------]|*9 [3:-------------------------]| ## grid 2 ^example text that is wide| r than the window | - | - | + |*2 more text | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 {1:some info! }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 2, 3, 7, true } + [4] = { 1001, "NW", 2, 3, 7, true } }} else screen:expect{grid=[[ @@ -4637,10 +3889,7 @@ describe('float window', function() | {1:some info! } | more text | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]} end @@ -4649,44 +3898,24 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| + [2:-------------------------]|*9 [3:-------------------------]| ## grid 2 {28:^+-- 5 lines: just some··}| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ## grid 3 | ## grid 4 {1:some info! }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 2, 2, 0, true } + [4] = { 1001, "NW", 2, 2, 0, true } }} else screen:expect{grid=[[ {28:^+-- 5 lines: just some··}| {0:~ }| {1:some info! }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*6 | ]]} end @@ -4699,57 +3928,44 @@ describe('float window', function() if multigrid then screen:expect([[ ## grid 1 - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| + [2:------------------------------]|*4 [3:------------------------------]| ## grid 2 that is wider than the windo^w | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ]]) else screen:expect([[ that is wider than the windo^w | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 | ]]) end - local buf = meths.create_buf(false,true) - meths.buf_set_lines(buf, 0, -1, true, {'some floaty text'}) - meths.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 - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| + [2:------------------------------]|*4 [3:------------------------------]| ## grid 2 that is wider than the windo^w | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 {1:some floaty text }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 3, 1, true} + [4] = {1001, "NW", 1, 3, 1, true} }} else screen:expect([[ that is wider than the windo^w | - {0:~ }| - {0:~ }| + {0:~ }|*2 {0:~}{1:some floaty text }{0: }| | ]]) @@ -4763,19 +3979,15 @@ describe('float window', function() local screen2 = Screen.new(40,7) screen2:attach(nil, session2) screen2:set_default_attr_ids(attrs) - local buf = meths.create_buf(false,false) - meths.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} + [2]={1001, 'NW', 1, 2, 5} } screen:expect{grid=[[ ## grid 1 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ## grid 2 {1:^ }| @@ -4786,8 +3998,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^ }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end) @@ -4795,29 +4006,20 @@ describe('float window', function() it('handles resized screen', function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'such', 'very', 'float'}) - local win = meths.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}, + [4]={1001, 'NW', 1, 2, 10, true}, } if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -4842,16 +4044,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*4 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 3 | ## grid 4 @@ -4874,14 +4071,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*3 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| + {0:~ }|*2 ## grid 3 | ## grid 4 @@ -4903,8 +4097,7 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 [3:----------------------------------------]| ## grid 2 ^ | @@ -4928,8 +4121,7 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 [3:----------------------------------------]| ## grid 2 | @@ -4954,20 +4146,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -4988,25 +4171,16 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {height=3}) + api.nvim_win_set_config(win, {height=3}) feed('gg') if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -5030,20 +4204,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:--------------------------]| - [2:--------------------------]| - [2:--------------------------]| - [2:--------------------------]| - [2:--------------------------]| - [2:--------------------------]| + [2:--------------------------]|*6 [3:--------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -5067,20 +4232,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| - [2:-------------------------]| + [2:-------------------------]|*6 [3:-------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -5104,20 +4260,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:------------------------]| - [2:------------------------]| - [2:------------------------]| - [2:------------------------]| - [2:------------------------]| - [2:------------------------]| + [2:------------------------]|*6 [3:------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -5141,20 +4288,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------]| - [2:----------------]| - [2:----------------]| - [2:----------------]| - [2:----------------]| - [2:----------------]| + [2:----------------]|*6 [3:----------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -5178,20 +4316,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:---------------]| - [2:---------------]| - [2:---------------]| - [2:---------------]| - [2:---------------]| - [2:---------------]| + [2:---------------]|*6 [3:---------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -5215,20 +4344,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:--------------]| - [2:--------------]| - [2:--------------]| - [2:--------------]| - [2:--------------]| - [2:--------------]| + [2:--------------]|*6 [3:--------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -5252,20 +4372,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:------------]| - [2:------------]| - [2:------------]| - [2:------------]| - [2:------------]| - [2:------------]| + [2:------------]|*6 [3:------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -5312,20 +4423,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -5348,14 +4450,14 @@ describe('float window', function() it('does not crash with inccommand #9379', function() local expected_pos = { - [4]={{id=1001}, 'NW', 1, 2, 0, true}, + [4]={1001, 'NW', 1, 2, 0, true}, } command("set inccommand=split") command("set laststatus=2") - local buf = meths.create_buf(false,false) - meths.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 @@ -5365,19 +4467,12 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 {5:[No Name] }| [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 @@ -5402,11 +4497,7 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 {5:[Preview] }| [3:----------------------------------------]| ## grid 2 @@ -5435,19 +4526,12 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 {5:[No Name] }| [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 @@ -5469,52 +4553,39 @@ describe('float window', function() end) it('does not crash when set cmdheight #9680', function() - local buf = meths.create_buf(false,false) - meths.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.eval('1')) + eq(1, api.nvim_eval('1')) end) describe('and completion', function() before_each(function() - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5}).id - meths.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}) + api.nvim_set_option_value('winhl', 'Normal:ErrorMsg', {win=win}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {7:^ }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ]], float_pos={ - [4] = {{ id = 1001 }, "NW", 1, 2, 5, true}, + [4] = {1001, "NW", 1, 2, 5, true}, }} else screen:expect([[ | {0:~ }| {0:~ }{7:^ }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| + {0:~ }{12:~ }{0: }|*3 | ]]) end @@ -5522,38 +4593,27 @@ 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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 {7:x aa^ }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ## grid 5 {13: aa }| {1: word }| {1: longtext }| ]], float_pos={ - [4] = {{ id = 1001 }, "NW", 1, 2, 5, true, 50}, - [5] = {{ id = -1 }, "NW", 4, 1, 1, false, 100} + [4] = {1001, "NW", 1, 2, 5, true, 50}, + [5] = {-1, "NW", 4, 1, 1, false, 100} }} else screen:expect([[ @@ -5571,29 +4631,18 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {7:x a^a }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ]], float_pos={ - [4] = {{ id = 1001 }, "NW", 1, 2, 5, true}, + [4] = {1001, "NW", 1, 2, 5, true}, }} else @@ -5601,46 +4650,33 @@ describe('float window', function() | {0:~ }| {0:~ }{7:x a^a }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| + {0:~ }{12:~ }{0: }|*3 | ]]) end feed('<c-w>wi') - funcs.complete(1, {'xx', 'yy', 'zz'}) + fn.complete(1, {'xx', 'yy', 'zz'}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 xx^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 {7:x aa }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ## grid 5 {13:xx }| {1:yy }| {1:zz }| ]], float_pos={ - [4] = {{ id = 1001 }, "NW", 1, 2, 5, true, 50}, - [5] = {{ id = -1 }, "NW", 2, 1, 0, false, 100} + [4] = {1001, "NW", 1, 2, 5, true, 50}, + [5] = {-1, "NW", 2, 1, 0, false, 100} }} else screen:expect([[ @@ -5648,8 +4684,7 @@ describe('float window', function() {13:xx }{0: }| {1:yy }{7: }{0: }| {1:zz }{12: }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| + {0:~ }{12:~ }{0: }|*2 {3:-- INSERT --} | ]]) end @@ -5658,38 +4693,25 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 xx^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 {7:x aa }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ]], float_pos={ - [4] = {{ id = 1001 }, "NW", 1, 2, 5, true}, + [4] = {1001, "NW", 1, 2, 5, true}, }} else screen:expect([[ xx^ | {0:~ }| {0:~ }{7:x aa }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| + {0:~ }{12:~ }{0: }|*3 {3:-- INSERT --} | ]]) end @@ -5701,33 +4723,22 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :sign un^ | ## grid 4 {7: }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ## grid 5 {1: undefine }| {1: unplace }| ]], float_pos={ - [5] = {{id = -1}, "SW", 1, 6, 5, false, 250}; - [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50}; + [5] = {-1, "SW", 1, 6, 5, false, 250}; + [4] = {1001, "NW", 1, 2, 5, true, 50}; }} else screen:expect{grid=[[ @@ -5745,34 +4756,23 @@ 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=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 {7:x aa^ }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ]], float_pos={ - [4] = {{ id = 1001 }, "NW", 1, 2, 5, true}, + [4] = {1001, "NW", 1, 2, 5, true}, }, popupmenu={ anchor = {4, 0, 2}, items = items, pos = 0 }} @@ -5781,9 +4781,7 @@ describe('float window', function() | {0:~ }| {0:~ }{7:x aa^ }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| + {0:~ }{12:~ }{0: }|*3 {3:-- INSERT --} | ]], popupmenu={ anchor = {1, 2, 7}, items = items, pos = 0 @@ -5794,71 +4792,47 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {7:x a^a }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ]], float_pos={ - [4] = {{ id = 1001 }, "NW", 1, 2, 5, true}, + [4] = {1001, "NW", 1, 2, 5, true}, }} else screen:expect([[ | {0:~ }| {0:~ }{7:x a^a }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| + {0:~ }{12:~ }{0: }|*3 | ]]) end feed('<c-w>wi') - funcs.complete(1, {'xx', 'yy', 'zz'}) + fn.complete(1, {'xx', 'yy', 'zz'}) items = {{"xx", "", "", ""}, {"yy", "", "", ""}, {"zz", "", "", ""}} if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 xx^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 {7:x aa }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ]], float_pos={ - [4] = {{ id = 1001 }, "NW", 1, 2, 5, true}, + [4] = {1001, "NW", 1, 2, 5, true}, }, popupmenu={ anchor = {2, 0, 0}, items = items, pos = 0 }} @@ -5867,9 +4841,7 @@ describe('float window', function() xx^ | {0:~ }| {0:~ }{7:x aa }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| + {0:~ }{12:~ }{0: }|*3 {3:-- INSERT --} | ]], popupmenu={ anchor = {1, 0, 0}, items = items, pos = 0 @@ -5880,38 +4852,25 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 xx^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 {7:x aa }| - {12:~ }| - {12:~ }| - {12:~ }| + {12:~ }|*3 ]], float_pos={ - [4] = {{ id = 1001 }, "NW", 1, 2, 5, true}, + [4] = {1001, "NW", 1, 2, 5, true}, }} else screen:expect([[ xx^ | {0:~ }| {0:~ }{7:x aa }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| - {0:~ }{12:~ }{0: }| + {0:~ }{12:~ }{0: }|*3 {3:-- INSERT --} | ]]) end @@ -5921,26 +4880,17 @@ describe('float window', function() describe('float shown after pum', function() local win before_each(function() - command('hi NormalFloat guibg=#333333') + 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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 aa^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 @@ -5948,7 +4898,7 @@ describe('float window', function() {1:word }| {1:longtext }| ]], float_pos={ - [4] = {{id = -1}, "NW", 2, 1, 0, false, 100}} + [4] = {-1, "NW", 2, 1, 0, false, 100}} } else screen:expect([[ @@ -5956,32 +4906,22 @@ describe('float window', function() {13:aa }{0: }| {1:word }{0: }| {1:longtext }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- INSERT --} | ]]) end - local buf = meths.create_buf(false,true) - meths.buf_set_lines(buf,0,-1,true,{"some info", "about item"}) - win = meths.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 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 aa^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 @@ -5992,8 +4932,8 @@ describe('float window', function() {15:some info }| {15:about item }| ]], float_pos={ - [4] = {{id = -1}, "NW", 2, 1, 0, false, 100}, - [5] = {{id = 1001}, "NW", 2, 1, 12, true, 50}, + [4] = {-1, "NW", 2, 1, 0, false, 100}, + [5] = {1001, "NW", 2, 1, 12, true, 50}, }} else screen:expect([[ @@ -6001,8 +4941,7 @@ describe('float window', function() {13:aa }{15:e info }{0: }| {1:word }{15:ut item }{0: }| {1:longtext }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- INSERT --} | ]]) end @@ -6013,93 +4952,60 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 aa^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 5 {15:some info }| {15:about item }| ]], float_pos={ - [5] = {{id = 1001}, "NW", 2, 1, 12, true}, + [5] = {1001, "NW", 2, 1, 12, true}, }} else screen:expect([[ aa^ | {0:~ }{15:some info }{0: }| {0:~ }{15:about item }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- INSERT --} | ]]) end - meths.win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 aa^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ]]) else screen:expect([[ aa^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- INSERT --} | ]]) end end) it('and close float first', function() - meths.win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 aa^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 @@ -6107,7 +5013,7 @@ describe('float window', function() {1:word }| {1:longtext }| ]], float_pos={ - [4] = {{id = -1}, "NW", 2, 1, 0, false, 100}, + [4] = {-1, "NW", 2, 1, 0, false, 100}, }} else screen:expect([[ @@ -6115,8 +5021,7 @@ describe('float window', function() {13:aa }{0: }| {1:word }{0: }| {1:longtext }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- INSERT --} | ]]) end @@ -6125,31 +5030,18 @@ describe('float window', function() if multigrid then screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 aa^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ]]) else screen:expect([[ aa^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- INSERT --} | ]]) end @@ -6157,38 +5049,29 @@ describe('float window', function() end) it("can use Normal as background", function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf,0,-1,true,{"here", "float"}) - local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.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=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 here | float | ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50}; + [4] = {1001, "NW", 1, 2, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -6196,8 +5079,7 @@ describe('float window', function() {0:~ }| {0:~ }here {0: }| {0:~ }float {0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]} end @@ -6210,30 +5092,21 @@ describe('float window', function() -- the default, but be explicit: command("set laststatus=1") command("set hidden") - meths.buf_set_lines(0,0,-1,true,{"x"}) - local buf = meths.create_buf(false,false) - win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.buf_set_lines(buf,0,-1,true,{"y"}) + api.nvim_buf_set_lines(0,0,-1,true,{"x"}) + local buf = api.nvim_create_buf(false,false) + win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + api.nvim_buf_set_lines(buf,0,-1,true,{"y"}) expected_pos = { - [4]={{id=1001}, 'NW', 1, 2, 5, true} + [4]={1001, 'NW', 1, 2, 5, true} } if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6246,8 +5119,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6258,20 +5130,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6284,8 +5147,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6294,20 +5156,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6320,34 +5173,24 @@ describe('float window', function() {0:~ }| {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end end) it("w with focusable=false", function() - meths.win_set_config(win, {focusable=false}) + api.nvim_win_set_config(win, {focusable=false}) expected_pos[4][6] = false feed("<c-w>wi") -- i to provoke redraw if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 @@ -6360,8 +5203,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- INSERT --} | ]]) end @@ -6370,20 +5212,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6396,8 +5229,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6408,20 +5240,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6434,8 +5257,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6444,20 +5266,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6470,8 +5283,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6479,23 +5291,14 @@ describe('float window', function() it("focus by mouse", function() if multigrid then - meths.input_mouse('left', 'press', '', 4, 0, 0) + api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6503,36 +5306,26 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos} else - meths.input_mouse('left', 'press', '', 0, 2, 5) + api.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect([[ x | {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end if multigrid then - meths.input_mouse('left', 'press', '', 2, 0, 0) + api.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6540,41 +5333,32 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos} else - meths.input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ ^x | {0:~ }| {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end end) it("focus by mouse (focusable=false)", function() - meths.win_set_config(win, {focusable=false}) - meths.buf_set_lines(0, -1, -1, true, {"a"}) + api.nvim_win_set_config(win, {focusable=false}) + api.nvim_buf_set_lines(0, -1, -1, true, {"a"}) expected_pos[4][6] = false if multigrid then - meths.input_mouse('left', 'press', '', 4, 0, 0) + api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | a | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 @@ -6582,36 +5366,27 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos} else - meths.input_mouse('left', 'press', '', 0, 2, 5) + api.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect([[ x | ^a | {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end if multigrid then - meths.input_mouse('left', 'press', '', 2, 0, 0) + api.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | a | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 @@ -6619,14 +5394,13 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos, unchanged=true} else - meths.input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ ^x | a | {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6637,20 +5411,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- INSERT --} | ## grid 4 @@ -6663,8 +5428,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- INSERT --} | ]]) end @@ -6673,20 +5437,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6699,8 +5454,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6709,20 +5463,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6735,8 +5480,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6748,20 +5492,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6774,8 +5509,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6784,34 +5518,23 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {1:^y }| - {2:~ }| - {2:~ }| + {2:~ }|*2 ]], float_pos=expected_pos} else screen:expect([[ x | {0:~ }| {0:~ }{1:^y }{0: }| - {0:~ }{2:~ }{0: }| - {0:~ }{2:~ }{0: }| + {0:~ }{2:~ }{0: }|*2 {0:~ }| | ]]) @@ -6821,20 +5544,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6845,9 +5559,7 @@ describe('float window', function() x | {0:~ }| {0:~ }{1:^y }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 | ]]) end @@ -6856,36 +5568,23 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {1:^y }| - {2:~ }| - {2:~ }| - {2:~ }| + {2:~ }|*3 ]], float_pos=expected_pos} else screen:expect([[ x | {0:~ }| {0:~ }{1:^y }{0: }| - {0:~ }{2:~ }{0: }| - {0:~ }{2:~ }{0: }| - {0:~ }{2:~ }{0: }| + {0:~ }{2:~ }{0: }|*3 | ]]) end @@ -6894,38 +5593,21 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {1:^y }| - {2:~ }| - {2:~ }| - {2:~ }| - {2:~ }| - {2:~ }| + {2:~ }|*5 ]], float_pos=expected_pos} else screen:expect([[ x {1:^y } | - {0:~ }{2:~ }{0: }| - {0:~ }{2:~ }{0: }| - {0:~ }{2:~ }{0: }| - {0:~ }{2:~ }{0: }| - {0:~ }{2:~ }{0: }| + {0:~ }{2:~ }{0: }|*5 | ]]) end @@ -6936,20 +5618,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6962,8 +5635,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -6972,20 +5644,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -6998,8 +5661,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -7008,20 +5670,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -7034,8 +5687,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -7044,20 +5696,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -7070,8 +5713,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -7080,20 +5722,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -7106,8 +5739,7 @@ describe('float window', function() {0:~ }| {1:^y }| {2:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -7118,11 +5750,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {4:[No Name] [+] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7153,11 +5783,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {5:[No Name] [+] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7188,11 +5816,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {5:[No Name] [+] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7224,11 +5850,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {4:[No Name] [+] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7261,11 +5885,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {4:[No Name] [+] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7296,11 +5918,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {5:[No Name] [+] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7331,11 +5951,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {5:[No Name] [+] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7368,11 +5986,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {4:[No Name] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7405,11 +6021,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {4:[No Name] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7442,19 +6056,12 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| + [5:--------------------]{5:│}[2:-------------------]|*5 {4:[No Name] [+] }{5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 @@ -7462,10 +6069,7 @@ describe('float window', function() {2:~ }| ## grid 5 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ]], float_pos=expected_pos} else screen:expect([[ @@ -7485,19 +6089,12 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| + [5:--------------------]{5:│}[2:-------------------]|*5 {4:[No Name] }{5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 :vnew | ## grid 4 @@ -7505,10 +6102,7 @@ describe('float window', function() {2:~ }| ## grid 5 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ]], float_pos=expected_pos} else screen:expect([[ @@ -7528,19 +6122,12 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| - [5:--------------------]{5:│}[2:-------------------]| + [5:--------------------]{5:│}[2:-------------------]|*5 {4:[No Name] }{5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 :vnew | ## grid 4 @@ -7548,10 +6135,7 @@ describe('float window', function() {2:~ }| ## grid 5 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ]], float_pos=expected_pos} else screen:expect([[ @@ -7592,24 +6176,15 @@ describe('float window', function() -- enter first float feed('<c-w><c-w>') -- enter second float - meths.open_win(0, true, {relative='editor', width=20, height=2, row=4, col=8}) + api.nvim_open_win(0, true, {relative='editor', width=20, height=2, row=4, col=8}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -7619,8 +6194,8 @@ describe('float window', function() {1:^y }| {2:~ }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 2, 5, true}, - [5] = {{id = 1002}, "NW", 1, 4, 8, true} + [4] = {1001, "NW", 1, 2, 5, true}, + [5] = {1002, "NW", 1, 4, 8, true} }} else screen:expect([[ @@ -7638,27 +6213,18 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :quit | ## grid 4 {1:^y }| {2:~ }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 2, 5, true}, + [4] = {1001, "NW", 1, 2, 5, true}, }} else screen:expect([[ @@ -7666,8 +6232,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 :quit | ]]) end @@ -7676,31 +6241,18 @@ describe('float window', function() if multigrid then screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :quit | ]]) else screen:expect([[ ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 :quit | ]]) end @@ -7713,31 +6265,18 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ]]} else screen:expect([[ ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end @@ -7748,20 +6287,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [3:----------------------------------------]| - [3:----------------------------------------]| - [3:----------------------------------------]| + [2:----------------------------------------]|*4 + [3:----------------------------------------]|*3 ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {7:E5601: Cannot close window, only floatin}| {7:g window would remain} | @@ -7787,20 +6317,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -7813,8 +6334,7 @@ describe('float window', function() {0:~ }| {0:~ }{1:^y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end @@ -7825,11 +6345,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {4:[No Name] [+] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7860,31 +6378,18 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 3 | ## grid 5 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ]]} else screen:expect([[ ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end @@ -7895,11 +6400,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {5:[No Name] [+] }| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7930,13 +6433,10 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*2 {5:[No Name] [+] }| [2:----------------------------------------]| - [3:----------------------------------------]| - [3:----------------------------------------]| - [3:----------------------------------------]| + [3:----------------------------------------]|*3 ## grid 2 x | {0:~ }| @@ -7969,11 +6469,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*2 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -7998,23 +6496,16 @@ describe('float window', function() end if multigrid then - meths.win_set_config(0, {external=true, width=30, height=2}) + api.nvim_win_set_config(0, {external=true, width=30, height=2}) expected_pos = {[4]={external=true}} screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 {5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 @@ -8023,7 +6514,7 @@ describe('float window', function() ]], float_pos=expected_pos} else eq("UI doesn't support external windows", - pcall_err(meths.win_set_config, 0, {external=true, width=30, height=2})) + pcall_err(api.nvim_win_set_config, 0, {external=true, width=30, height=2})) return end @@ -8031,11 +6522,9 @@ describe('float window', function() if multigrid then screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*2 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -8051,24 +6540,15 @@ describe('float window', function() end) it('J (float with border)', function() - meths.win_set_config(win, {relative='editor', width=20, height=2, row=2, col=5, border='single'}) + api.nvim_win_set_config(win, {relative='editor', width=20, height=2, row=2, col=5, border='single'}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -8093,11 +6573,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*2 {5:[No Name] [+] }| - [4:----------------------------------------]| - [4:----------------------------------------]| + [4:----------------------------------------]|*2 {4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -8128,11 +6606,9 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [6:--------------------]{5:│}[5:-------------------]| - [6:--------------------]{5:│}[5:-------------------]| + [6:--------------------]{5:│}[5:-------------------]|*2 {5:[No Name] [+] [No Name] [+] }| - [7:--------------------]{5:│}[2:-------------------]| - [7:--------------------]{5:│}[2:-------------------]| + [7:--------------------]{5:│}[2:-------------------]|*2 {4:[No Name] [+] }{5:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -8169,17 +6645,15 @@ describe('float window', function() for i = 1,5 do feed(i.."<c-w>w") feed_command("enew") - curbufmeths.set_lines(0,-1,true,{tostring(i)}) + api.nvim_buf_set_lines(0, 0,-1,true,{tostring(i)}) end if multigrid then screen:expect{grid=[[ ## grid 1 - [6:-------------------]{5:│}[5:--------------------]| - [6:-------------------]{5:│}[5:--------------------]| + [6:-------------------]{5:│}[5:--------------------]|*2 {5:[No Name] [+] [No Name] [+] }| - [7:-------------------]{5:│}[2:--------------------]| - [7:-------------------]{5:│}[2:--------------------]| + [7:-------------------]{5:│}[2:--------------------]|*2 {5:[No Name] [+] [No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -8227,7 +6701,7 @@ describe('float window', function() for i = 1,5 do feed(i.."<c-w>w") feed('<c-w>'..k) - local nr = funcs.winnr() + local nr = fn.winnr() eq(v[i],nr, "when using <c-w>"..k.." from window "..i) end end @@ -8238,7 +6712,7 @@ describe('float window', function() if j ~= i then feed(j.."<c-w>w") feed('<c-w>p') - local nr = funcs.winnr() + local nr = fn.winnr() eq(i,nr, "when using <c-w>p to window "..i.." from window "..j) end end @@ -8253,19 +6727,11 @@ describe('float window', function() screen:expect{grid=[[ ## grid 1 {9: }{10:2}{9:+ [No Name] }{3: [No Name] }{5: }{9:X}| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*5 [3:----------------------------------------]| ## grid 2 (hidden) x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :tabnew | ## grid 4 (hidden) @@ -8273,19 +6739,13 @@ describe('float window', function() {2:~ }| ## grid 5 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ]]} else screen:expect([[ {9: }{10:2}{9:+ [No Name] }{3: [No Name] }{5: }{9:X}| ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 :tabnew | ]]) end @@ -8295,18 +6755,11 @@ describe('float window', function() screen:expect{grid=[[ ## grid 1 {3: }{11:2}{3:+ [No Name] }{9: [No Name] }{5: }{9:X}| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 :tabnext | ## grid 4 @@ -8314,10 +6767,7 @@ describe('float window', function() {2:~ }| ## grid 5 (hidden) | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ]], float_pos=expected_pos} else screen:expect([[ @@ -8325,8 +6775,7 @@ describe('float window', function() ^x | {0:~ }{1:y }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 :tabnext | ]]) end @@ -8336,18 +6785,11 @@ describe('float window', function() screen:expect{grid=[[ ## grid 1 {9: }{10:2}{9:+ [No Name] }{3: [No Name] }{5: }{9:X}| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*5 [3:----------------------------------------]| ## grid 2 (hidden) x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 :tabnext | ## grid 4 (hidden) @@ -8355,19 +6797,13 @@ describe('float window', function() {2:~ }| ## grid 5 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ]]} else screen:expect([[ {9: }{10:2}{9:+ [No Name] }{3: [No Name] }{5: }{9:X}| ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 :tabnext | ]]) end @@ -8376,42 +6812,29 @@ describe('float window', function() it(":tabnew and :tabnext (external)", function() if multigrid then -- also test external window wider than main screen - meths.win_set_config(win, {external=true, width=65, height=4}) + api.nvim_win_set_config(win, {external=true, width=65, height=4}) expected_pos = {[4]={external=true}} feed(":tabnew<cr>") screen:expect{grid=[[ ## grid 1 {9: + [No Name] }{3: }{11:2}{3:+ [No Name] }{5: }{9:X}| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*5 [3:----------------------------------------]| ## grid 2 (hidden) x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :tabnew | ## grid 4 y | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 5 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ]], float_pos=expected_pos} else eq("UI doesn't support external windows", - pcall_err(meths.win_set_config, 0, {external=true, width=65, height=4})) + pcall_err(api.nvim_win_set_config, 0, {external=true, width=65, height=4})) end feed(":tabnext<cr>") @@ -8419,31 +6842,19 @@ describe('float window', function() screen:expect{grid=[[ ## grid 1 {3: }{11:2}{3:+ [No Name] }{9: [No Name] }{5: }{9:X}| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*5 [3:----------------------------------------]| ## grid 2 ^x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 :tabnext | ## grid 4 y | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 5 (hidden) | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ]], float_pos=expected_pos} end @@ -8452,57 +6863,36 @@ describe('float window', function() screen:expect{grid=[[ ## grid 1 {9: + [No Name] }{3: }{11:2}{3:+ [No Name] }{5: }{9:X}| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| - [5:----------------------------------------]| + [5:----------------------------------------]|*5 [3:----------------------------------------]| ## grid 2 (hidden) x | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 :tabnext | ## grid 4 y | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 ## grid 5 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ]], float_pos=expected_pos} end end) end) it("left drag changes visual selection in float window", function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - meths.open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=5}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -8510,29 +6900,20 @@ describe('float window', function() {1:bar }| {1:baz }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50}; + [4] = {1001, "NW", 1, 2, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'press', '', 4, 0, 0) + api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -8540,29 +6921,20 @@ describe('float window', function() {1:bar }| {1:baz }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50}; + [4] = {1001, "NW", 1, 2, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'drag', '', 4, 1, 2) + api.nvim_input_mouse('left', 'drag', '', 4, 1, 2) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- VISUAL --} | ## grid 4 @@ -8570,10 +6942,10 @@ describe('float window', function() {27:ba}{1:^r }| {1:baz }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50}; + [4] = {1001, "NW", 1, 2, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -8586,7 +6958,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'press', '', 0, 2, 5) + api.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect{grid=[[ | {0:~ }| @@ -8597,7 +6969,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'drag', '', 0, 3, 7) + api.nvim_input_mouse('left', 'drag', '', 0, 3, 7) screen:expect{grid=[[ | {0:~ }| @@ -8611,26 +6983,17 @@ describe('float window', function() end) it("left drag changes visual selection in float window with border", function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - meths.open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -8640,29 +7003,20 @@ describe('float window', function() {5:│}{1:baz }{5:│}| {5:└────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'press', '', 4, 1, 1) + api.nvim_input_mouse('left', 'press', '', 4, 1, 1) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -8672,29 +7026,20 @@ describe('float window', function() {5:│}{1:baz }{5:│}| {5:└────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'drag', '', 4, 2, 3) + api.nvim_input_mouse('left', 'drag', '', 4, 2, 3) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- VISUAL --} | ## grid 4 @@ -8704,10 +7049,10 @@ describe('float window', function() {5:│}{1:baz }{5:│}| {5:└────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -8720,7 +7065,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'press', '', 0, 1, 6) + api.nvim_input_mouse('left', 'press', '', 0, 1, 6) screen:expect{grid=[[ {5:┌────────────────────┐} | {0:~ }{5:│}{1:^foo }{5:│}{0: }| @@ -8731,7 +7076,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'drag', '', 0, 2, 8) + api.nvim_input_mouse('left', 'drag', '', 0, 2, 8) screen:expect{grid=[[ {5:┌────────────────────┐} | {0:~ }{5:│}{27:foo}{1: }{5:│}{0: }| @@ -8745,27 +7090,18 @@ describe('float window', function() end) it("left drag changes visual selection in float window with winbar", function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - local float_win = meths.open_win(buf, false, {relative='editor', width=20, height=4, row=1, col=5}) - meths.set_option_value('winbar', 'floaty bar', {win=float_win.id}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) + local float_win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=4, row=1, col=5}) + api.nvim_set_option_value('winbar', 'floaty bar', {win=float_win}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -8774,29 +7110,20 @@ describe('float window', function() {1:bar }| {1:baz }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 5, true, 50}; + [4] = {1001, "NW", 1, 1, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'press', '', 4, 1, 0) + api.nvim_input_mouse('left', 'press', '', 4, 1, 0) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -8805,29 +7132,20 @@ describe('float window', function() {1:bar }| {1:baz }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 5, true, 50}; + [4] = {1001, "NW", 1, 1, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'drag', '', 4, 2, 2) + api.nvim_input_mouse('left', 'drag', '', 4, 2, 2) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 {3:-- VISUAL --} | ## grid 4 @@ -8836,10 +7154,10 @@ describe('float window', function() {27:ba}{1:^r }| {1:baz }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 5, true, 50}; + [4] = {1001, "NW", 1, 1, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -8852,7 +7170,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'press', '', 0, 2, 5) + api.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect{grid=[[ | {0:~ }{3:floaty bar }{0: }| @@ -8863,7 +7181,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'drag', '', 0, 3, 7) + api.nvim_input_mouse('left', 'drag', '', 0, 3, 7) screen:expect{grid=[[ | {0:~ }{3:floaty bar }{0: }| @@ -8877,116 +7195,89 @@ describe('float window', function() end) it('left drag changes visual selection if float window is turned into a split', function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - meths.open_win(buf, true, {relative='editor', width=20, height=3, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) + api.nvim_open_win(buf, true, {relative='editor', width=20, height=3, row=2, col=5}) command('wincmd L') if multigrid then screen:expect([[ ## grid 1 - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| + [2:-------------------]{5:│}[4:--------------------]|*5 {5:[No Name] }{4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 ^foo | bar | baz | - {0:~ }| - {0:~ }| + {0:~ }|*2 ]]) - meths.input_mouse('left', 'press', '', 4, 2, 2) + api.nvim_input_mouse('left', 'press', '', 4, 2, 2) screen:expect([[ ## grid 1 - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| + [2:-------------------]{5:│}[4:--------------------]|*5 {5:[No Name] }{4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 foo | bar | ba^z | - {0:~ }| - {0:~ }| + {0:~ }|*2 ]]) - meths.input_mouse('left', 'drag', '', 4, 1, 1) + api.nvim_input_mouse('left', 'drag', '', 4, 1, 1) screen:expect([[ ## grid 1 - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| - [2:-------------------]{5:│}[4:--------------------]| + [2:-------------------]{5:│}[4:--------------------]|*5 {5:[No Name] }{4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 {3:-- VISUAL --} | ## grid 4 foo | b^a{27:r} | {27:baz} | - {0:~ }| - {0:~ }| + {0:~ }|*2 ]]) else screen:expect([[ {5:│}^foo | {0:~ }{5:│}bar | {0:~ }{5:│}baz | - {0:~ }{5:│}{0:~ }| - {0:~ }{5:│}{0:~ }| + {0:~ }{5:│}{0:~ }|*2 {5:[No Name] }{4:[No Name] [+] }| | ]]) - meths.input_mouse('left', 'press', '', 0, 2, 22) + api.nvim_input_mouse('left', 'press', '', 0, 2, 22) screen:expect([[ {5:│}foo | {0:~ }{5:│}bar | {0:~ }{5:│}ba^z | - {0:~ }{5:│}{0:~ }| - {0:~ }{5:│}{0:~ }| + {0:~ }{5:│}{0:~ }|*2 {5:[No Name] }{4:[No Name] [+] }| | ]]) - meths.input_mouse('left', 'drag', '', 0, 1, 21) + api.nvim_input_mouse('left', 'drag', '', 0, 1, 21) screen:expect([[ {5:│}foo | {0:~ }{5:│}b^a{27:r} | {0:~ }{5:│}{27:baz} | - {0:~ }{5:│}{0:~ }| - {0:~ }{5:│}{0:~ }| + {0:~ }{5:│}{0:~ }|*2 {5:[No Name] }{4:[No Name] [+] }| {3:-- VISUAL --} | ]]) @@ -8994,46 +7285,33 @@ describe('float window', function() end) it('left click sets correct curswant in float window with border', function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'', '', ''}) - meths.open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'', '', ''}) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {5:┌────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*3 {5:└────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ ^ {5:┌────────────────────┐} | - {0:~ }{5:│}{1: }{5:│}{0: }| - {0:~ }{5:│}{1: }{5:│}{0: }| - {0:~ }{5:│}{1: }{5:│}{0: }| + {0:~ }{5:│}{1: }{5:│}{0: }|*3 {0:~ }{5:└────────────────────┘}{0: }| {0:~ }| | @@ -9041,45 +7319,36 @@ describe('float window', function() end if multigrid then - meths.input_mouse('left', 'press', '', 4, 3, 1) + api.nvim_input_mouse('left', 'press', '', 4, 3, 1) else - meths.input_mouse('left', 'press', '', 0, 3, 6) + api.nvim_input_mouse('left', 'press', '', 0, 3, 6) end - eq({0, 3, 1, 0, 1}, funcs.getcurpos()) + eq({0, 3, 1, 0, 1}, fn.getcurpos()) if multigrid then - meths.input_mouse('left', 'press', '', 4, 3, 2) + api.nvim_input_mouse('left', 'press', '', 4, 3, 2) else - meths.input_mouse('left', 'press', '', 0, 3, 7) + api.nvim_input_mouse('left', 'press', '', 0, 3, 7) end - eq({0, 3, 1, 0, 2}, funcs.getcurpos()) + eq({0, 3, 1, 0, 2}, fn.getcurpos()) if multigrid then - meths.input_mouse('left', 'press', '', 4, 3, 10) + api.nvim_input_mouse('left', 'press', '', 4, 3, 10) else - meths.input_mouse('left', 'press', '', 0, 3, 15) + api.nvim_input_mouse('left', 'press', '', 0, 3, 15) end - eq({0, 3, 1, 0, 10}, funcs.getcurpos()) + eq({0, 3, 1, 0, 10}, fn.getcurpos()) command('setlocal foldcolumn=1') feed('zfkgg') if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -9089,10 +7358,10 @@ describe('float window', function() {5:│}{2:~ }{5:│}| {5:└────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 4, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 4, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9107,23 +7376,14 @@ describe('float window', function() end if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 1) + api.nvim_input_mouse('left', 'press', '', 4, 2, 1) screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -9133,13 +7393,13 @@ describe('float window', function() {5:│}{19:│}{1: }{5:│}| {5:└────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + [4] = {1001, "NW", 1, 0, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} else - meths.input_mouse('left', 'press', '', 0, 2, 6) + api.nvim_input_mouse('left', 'press', '', 0, 2, 6) screen:expect{grid=[[ {5:┌────────────────────┐} | {0:~ }{5:│}{19: }{1:^ }{5:│}{0: }| @@ -9152,25 +7412,25 @@ describe('float window', function() end if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 2) + api.nvim_input_mouse('left', 'press', '', 4, 2, 2) else - meths.input_mouse('left', 'press', '', 0, 2, 7) + api.nvim_input_mouse('left', 'press', '', 0, 2, 7) end - eq({0, 2, 1, 0, 1}, funcs.getcurpos()) + eq({0, 2, 1, 0, 1}, fn.getcurpos()) if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 3) + api.nvim_input_mouse('left', 'press', '', 4, 2, 3) else - meths.input_mouse('left', 'press', '', 0, 2, 8) + api.nvim_input_mouse('left', 'press', '', 0, 2, 8) end - eq({0, 2, 1, 0, 2}, funcs.getcurpos()) + eq({0, 2, 1, 0, 2}, fn.getcurpos()) if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 11) + api.nvim_input_mouse('left', 'press', '', 4, 2, 11) else - meths.input_mouse('left', 'press', '', 0, 2, 16) + api.nvim_input_mouse('left', 'press', '', 0, 2, 16) end - eq({0, 2, 1, 0, 10}, funcs.getcurpos()) + eq({0, 2, 1, 0, 10}, fn.getcurpos()) end) it("'winblend' option", function() @@ -9188,8 +7448,8 @@ describe('float window', function() [10] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend = 0}, [11] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend = 80}, [12] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1, blend = 30}, - [13] = {background = Screen.colors.LightGray, blend = 30}, - [14] = {foreground = Screen.colors.Grey0, background = Screen.colors.Grey88}, + [13] = {foreground = Screen.colors.Black, background = Screen.colors.LightGray, blend = 30}, + [14] = {foreground = Screen.colors.Black, background = Screen.colors.Grey88}, [15] = {foreground = tonumber('0x939393'), background = Screen.colors.Grey88}, [16] = {background = Screen.colors.Grey90}; [17] = {blend = 100}; @@ -9214,20 +7474,13 @@ describe('float window', function() occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.]]) - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {"test", "", "popup text"}) - local win = meths.open_win(buf, false, {relative='editor', width=15, height=3, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {"test", "", "popup text"}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=15, height=3, row=2, col=5}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| + [2:--------------------------------------------------]|*8 [3:--------------------------------------------------]| ## grid 2 Ut enim ad minim veniam, quis nostrud | @@ -9244,7 +7497,7 @@ describe('float window', function() {1:test }| {1: }| {1:popup text }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}} + ]], float_pos={[4] = {1001, "NW", 1, 2, 5, true}}} else screen:expect([[ Ut enim ad minim veniam, quis nostrud | @@ -9259,18 +7512,11 @@ describe('float window', function() ]]) end - meths.set_option_value("winblend", 30, {win=win.id}) + api.nvim_set_option_value("winblend", 30, {win=win}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| + [2:--------------------------------------------------]|*8 [3:--------------------------------------------------]| ## grid 2 Ut enim ad minim veniam, quis nostrud | @@ -9287,7 +7533,7 @@ describe('float window', function() {9:test }| {9: }| {9:popup text }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}, unchanged=true} + ]], float_pos={[4] = {1001, "NW", 1, 2, 5, true}}, unchanged=true} else screen:expect([[ Ut enim ad minim veniam, quis nostrud | @@ -9303,18 +7549,11 @@ describe('float window', function() end -- Check that 'winblend' works with NormalNC highlight - meths.set_option_value('winhighlight', 'NormalNC:Visual', {win = win}) + api.nvim_set_option_value('winhighlight', 'NormalNC:Visual', {win = win}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| + [2:--------------------------------------------------]|*8 [3:--------------------------------------------------]| ## grid 2 Ut enim ad minim veniam, quis nostrud | @@ -9331,7 +7570,7 @@ describe('float window', function() {13:test }| {13: }| {13:popup text }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}} + ]], float_pos={[4] = {1001, "NW", 1, 2, 5, true}}} else screen:expect([[ Ut enim ad minim veniam, quis nostrud | @@ -9355,18 +7594,11 @@ describe('float window', function() command('hi clear NormalNC') command('hi SpecialRegion guifg=Red blend=0') - meths.buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1) + api.nvim_buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| + [2:--------------------------------------------------]|*8 [3:--------------------------------------------------]| ## grid 2 Ut enim ad minim veniam, quis nostrud | @@ -9383,7 +7615,7 @@ describe('float window', function() {9:test }| {9: }| {10:popup text}{9: }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}} + ]], float_pos={[4] = {1001, "NW", 1, 2, 5, true}}} else screen:expect([[ Ut enim ad minim veniam, quis nostrud | @@ -9402,14 +7634,7 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| + [2:--------------------------------------------------]|*8 [3:--------------------------------------------------]| ## grid 2 Ut enim ad minim veniam, quis nostrud | @@ -9426,7 +7651,7 @@ describe('float window', function() {9:test }| {9: }| {11:popup text}{9: }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}, unchanged=true} + ]], float_pos={[4] = {1001, "NW", 1, 2, 5, true}}, unchanged=true} else screen:expect([[ Ut enim ad minim veniam, quis nostrud | @@ -9443,17 +7668,10 @@ describe('float window', function() -- Test scrolling by mouse if multigrid then - meths.input_mouse('wheel', 'down', '', 4, 2, 2) + api.nvim_input_mouse('wheel', 'down', '', 4, 2, 2) screen:expect{grid=[[ ## grid 1 - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| + [2:--------------------------------------------------]|*8 [3:--------------------------------------------------]| ## grid 2 Ut enim ad minim veniam, quis nostrud | @@ -9468,11 +7686,10 @@ describe('float window', function() | ## grid 4 {11:popup text}{9: }| - {12:~ }| - {12:~ }| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}} + {12:~ }|*2 + ]], float_pos={[4] = {1001, "NW", 1, 2, 5, true}}} else - meths.input_mouse('wheel', 'down', '', 0, 4, 7) + api.nvim_input_mouse('wheel', 'down', '', 0, 4, 7) screen:expect([[ Ut enim ad minim veniam, quis nostrud | exercitation ullamco laboris nisi ut aliquip ex | @@ -9487,22 +7704,15 @@ describe('float window', function() end -- Check that 'winblend' applies to border/title/footer - meths.win_set_config(win, {border='single', title='Title', footer='Footer'}) - meths.set_option_value('winblend', 100, {win=win.id}) - meths.set_option_value("cursorline", true, {win=0}) + api.nvim_win_set_config(win, {border='single', title='Title', footer='Footer'}) + api.nvim_set_option_value('winblend', 100, {win=win}) + api.nvim_set_option_value("cursorline", true, {win=0}) command('hi clear VertSplit') feed('k0') if multigrid then screen:expect{grid=[[ ## grid 1 - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| - [2:--------------------------------------------------]| + [2:--------------------------------------------------]|*8 [3:--------------------------------------------------]| ## grid 2 Ut enim ad minim veniam, quis nostrud | @@ -9518,10 +7728,9 @@ describe('float window', function() ## grid 4 {17:┌}{23:Title}{17:──────────┐}| {17:│}{11:popup text}{18: }{17:│}| - {17:│}{19:~ }{17:│}| - {17:│}{19:~ }{17:│}| + {17:│}{19:~ }{17:│}|*2 {17:└}{23:Footer}{17:─────────┘}| - ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}} + ]], float_pos={[4] = {1001, "NW", 1, 2, 5, true}}} else screen:expect([[ Ut enim ad minim veniam, quis nostrud | @@ -9541,63 +7750,44 @@ describe('float window', function() insert([[ # TODO: 测试字典信息的准确性 # FIXME: 测试字典信息的准确性]]) - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'口', '口'}) - local win = meths.open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'口', '口'}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 # TODO: 测试字典信息的准确性 | # FIXME: 测试字典信息的准确^性 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ## grid 4 - {1:口 }| - {1:口 }| + {1:口 }|*2 {1: }| - ]], float_pos={ [4] = { { id = 1001 }, "NW", 1, 0, 11, true } }} + ]], float_pos={ [4] = { 1001, "NW", 1, 0, 11, true } }} else screen:expect([[ # TODO: 测 {1:口 }信息的准确性 | # FIXME: 测{1:口 } 信息的准确^性 | {0:~ }{1: }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 | ]]) end - meths.win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 # TODO: 测试字典信息的准确性 | # FIXME: 测试字典信息的准确^性 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 ## grid 3 | ]]) @@ -9605,10 +7795,7 @@ describe('float window', function() screen:expect([[ # TODO: 测试字典信息的准确性 | # FIXME: 测试字典信息的准确^性 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]) end @@ -9616,9 +7803,9 @@ describe('float window', function() -- The interaction between 'winblend' and doublewidth chars in the background -- does not look very good. But check no chars get incorrectly placed -- at least. Also check invisible EndOfBuffer region blends correctly. - meths.buf_set_lines(buf, 0, -1, true, {" x x x xx", " x x x x"}) - win = meths.open_win(buf, false, {relative='editor', width=12, height=3, row=0, col=11, style='minimal'}) - meths.set_option_value('winblend', 30, {win=win.id}) + api.nvim_buf_set_lines(buf, 0, -1, true, {" x x x xx", " x x x x"}) + win = api.nvim_open_win(buf, false, {relative='editor', width=12, height=3, row=0, col=11, style='minimal'}) + api.nvim_set_option_value('winblend', 30, {win=win}) screen:set_default_attr_ids({ [1] = {foreground = tonumber('0xb282b2'), background = tonumber('0xffcfff')}, [2] = {foreground = Screen.colors.Grey0, background = tonumber('0xffcfff')}, @@ -9629,20 +7816,12 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 # TODO: 测试字典信息的准确性 | # FIXME: 测试字典信息的准确^性 | - {3:~ }| - {3:~ }| - {3:~ }| - {3:~ }| + {3:~ }|*4 ## grid 3 | ## grid 5 @@ -9650,38 +7829,28 @@ describe('float window', function() {5: x x x x}| {5: }| ]], float_pos={ - [5] = { { id = 1002 }, "NW", 1, 0, 11, true } + [5] = { 1002, "NW", 1, 0, 11, true } }} else screen:expect([[ # TODO: 测 {2: x x x}{1:息}{2: xx} 确性 | # FIXME: 测{1:试}{2:x x x}{1:息}{2: x}准确^性 | {3:~ }{4: }{3: }| - {3:~ }| - {3:~ }| - {3:~ }| + {3:~ }|*3 | ]]) end - meths.win_set_config(win, {relative='editor', row=0, col=12}) + api.nvim_win_set_config(win, {relative='editor', row=0, col=12}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 # TODO: 测试字典信息的准确性 | # FIXME: 测试字典信息的准确^性 | - {3:~ }| - {3:~ }| - {3:~ }| - {3:~ }| + {3:~ }|*4 ## grid 3 | ## grid 5 @@ -9689,16 +7858,14 @@ describe('float window', function() {5: x x x x}| {5: }| ]], float_pos={ - [5] = { { id = 1002 }, "NW", 1, 0, 12, true } + [5] = { 1002, "NW", 1, 0, 12, true } }} else screen:expect([[ # TODO: 测试{2: x x}{1:信}{2:x }{1:的}{2:xx}确性 | # FIXME: 测 {2: x x}{1:信}{2:x }{1:的}{2:x} 确^性 | {3:~ }{4: }{3: }| - {3:~ }| - {3:~ }| - {3:~ }| + {3:~ }|*3 | ]]) end @@ -9735,20 +7902,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| + {1:~ }|*5 ## grid 3 | ## grid 4 @@ -9757,20 +7915,14 @@ describe('float window', function() {2:longest}| ## grid 5 {2:---------}| - {2:- -}| - {2:- -}| - {2: }| - {2: }| + {2:- -}|*2 + {2: }|*2 ]], attr_ids={ [1] = {foreground = Screen.colors.Blue1, bold = true}; [2] = {background = Screen.colors.LightMagenta}; }, float_pos={ - [4] = { { - id = 1001 - }, "NW", 1, 1, 1, true }, - [5] = { { - id = 1002 - }, "NW", 1, 0, 0, true } + [4] = { 1001, "NW", 1, 1, 1, true }, + [5] = { 1002, "NW", 1, 0, 0, true } }} else screen:expect([[ @@ -9803,20 +7955,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| + {1:~ }|*5 ## grid 3 | ## grid 4 @@ -9825,16 +7968,14 @@ describe('float window', function() {2:n}| ## grid 5 {2:---}| - {2:- -}| - {2:- -}| - {2: }| - {2: }| + {2:- -}|*2 + {2: }|*2 ]], attr_ids={ [1] = {foreground = Screen.colors.Blue1, bold = true}; [2] = {background = Screen.colors.LightMagenta}; }, float_pos={ - [4] = { { id = 1001 }, "NW", 1, 1, 1, true }, - [5] = { { id = 1002 }, "NW", 1, 0, 0, true } + [4] = { 1001, "NW", 1, 1, 1, true }, + [5] = { 1002, "NW", 1, 0, 0, true } }} else screen:expect([[ @@ -9850,37 +7991,28 @@ describe('float window', function() end) it("correctly orders multiple opened floats (current last)", function() - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id}) + 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}) + api.nvim_set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {7: }| {7:~ }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true }; + [4] = { 1001, "NW", 1, 2, 5, true }; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9888,8 +8020,7 @@ describe('float window', function() {0:~ }| {0:~ }{7: }{0: }| {0:~ }{7:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]} end @@ -9906,20 +8037,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -9932,14 +8054,14 @@ describe('float window', function() {17:^ }| {17:~ }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true }; - [5] = { { id = 1002 }, "NW", 1, 3, 8, true }; - [6] = { { id = 1003 }, "NW", 1, 4, 10, true }; + [4] = { 1001, "NW", 1, 2, 5, true }; + [5] = { 1002, "NW", 1, 3, 8, true }; + [6] = { 1003, "NW", 1, 4, 10, true }; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; - [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; + [5] = {win = 1002, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; + [6] = {win = 1003, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9955,37 +8077,28 @@ describe('float window', function() end) it("correctly orders multiple opened floats (non-current last)", function() - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id}) + 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}) + api.nvim_set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {7: }| {7:~ }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true }; + [4] = { 1001, "NW", 1, 2, 5, true }; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9993,8 +8106,7 @@ describe('float window', function() {0:~ }| {0:~ }{7: }{0: }| {0:~ }{7:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]} end @@ -10011,20 +8123,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -10037,14 +8140,14 @@ describe('float window', function() {1: }| {1:~ }| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 2, 5, true }; - [5] = { { id = 1002 }, "NW", 1, 4, 10, true }; - [6] = { { id = 1003 }, "NW", 1, 3, 8, true }; + [4] = { 1001, "NW", 1, 2, 5, true }; + [5] = { 1002, "NW", 1, 4, 10, true }; + [6] = { 1003, "NW", 1, 3, 8, true }; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = 1002, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [6] = {win = 1003, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10060,54 +8163,42 @@ describe('float window', function() end) it('can use z-index', function() - local buf = meths.create_buf(false,false) - local win1 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=1, col=5, zindex=30}) - meths.set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win1.id}) - local win2 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=6, zindex=50}) - meths.set_option_value("winhl", "Normal:Search,EndOfBuffer:Search", {win=win2.id}) - local win3 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=3, col=7, zindex=40}) - meths.set_option_value("winhl", "Normal:Question,EndOfBuffer:Question", {win=win3.id}) + local buf = api.nvim_create_buf(false,false) + local win1 = api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=1, col=5, zindex=30}) + api.nvim_set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win1}) + local win2 = api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=6, zindex=50}) + api.nvim_set_option_value("winhl", "Normal:Search,EndOfBuffer:Search", {win=win2}) + local win3 = api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=3, col=7, zindex=40}) + api.nvim_set_option_value("winhl", "Normal:Question,EndOfBuffer:Question", {win=win3}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {7: }| - {7:~ }| - {7:~ }| + {7:~ }|*2 ## grid 5 {17: }| - {17:~ }| - {17:~ }| + {17:~ }|*2 ## grid 6 {8: }| - {8:~ }| - {8:~ }| + {8:~ }|*2 ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 5, true, 30}; - [5] = {{id = 1002}, "NW", 1, 2, 6, true, 50}; - [6] = {{id = 1003}, "NW", 1, 3, 7, true, 40}; + [4] = {1001, "NW", 1, 1, 5, true, 30}; + [5] = {1002, "NW", 1, 2, 6, true, 50}; + [6] = {1003, "NW", 1, 3, 7, true, 40}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = 1002, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [6] = {win = 1003, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10123,27 +8214,18 @@ describe('float window', function() end) it('can use winbar', function() - local buf = meths.create_buf(false,false) - local win1 = meths.open_win(buf, false, {relative='editor', width=15, height=3, row=1, col=5}) - meths.set_option_value('winbar', 'floaty bar', {win=win1.id}) + local buf = api.nvim_create_buf(false,false) + local win1 = api.nvim_open_win(buf, false, {relative='editor', width=15, height=3, row=1, col=5}) + api.nvim_set_option_value('winbar', 'floaty bar', {win=win1}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -10151,10 +8233,10 @@ describe('float window', function() {1: }| {2:~ }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 5, true, 50}; + [4] = {1001, "NW", 1, 1, 5, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10162,54 +8244,42 @@ describe('float window', function() {0:~ }{3:floaty bar }{0: }| {0:~ }{1: }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]} end -- resize and add a border - meths.win_set_config(win1, {relative='editor', width=15, height=4, row=0, col=4, border = 'single'}) + api.nvim_win_set_config(win1, {relative='editor', width=15, height=4, row=0, col=4, border = 'single'}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {5:┌───────────────┐}| {5:│}{3:floaty bar }{5:│}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*2 {5:└───────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 0, 4, true, 50}; + [4] = {1001, "NW", 1, 0, 4, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ ^ {5:┌───────────────┐} | {0:~ }{5:│}{3:floaty bar }{5:│}{0: }| {0:~ }{5:│}{1: }{5:│}{0: }| - {0:~ }{5:│}{2:~ }{5:│}{0: }| - {0:~ }{5:│}{2:~ }{5:│}{0: }| + {0:~ }{5:│}{2:~ }{5:│}{0: }|*2 {0:~ }{5:└───────────────┘}{0: }| | ]]} @@ -10219,55 +8289,33 @@ describe('float window', function() it('it can be resized with messages and cmdheight=0 #20106', function() screen:try_resize(40,9) command 'set cmdheight=0' - local buf = meths.create_buf(false,true) - local win = meths.open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=9, col=0, style='minimal', border="single", noautocmd=true}) + local buf = api.nvim_create_buf(false,true) + local win = api.nvim_open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=9, col=0, style='minimal', border="single", noautocmd=true}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*9 ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ## grid 3 ## grid 4 {5:┌────────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*4 {5:└────────────────────────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "SW", 1, 9, 0, true, 50}; + [4] = {1001, "SW", 1, 9, 0, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ ^ | - {0:~ }| - {0:~ }| + {0:~ }|*2 {5:┌──────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*4 {5:└──────────────────────────────────────┘}| ]]} end @@ -10281,144 +8329,83 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*9 ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ## grid 3 ## grid 4 {5:┌────────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*2 {5:└────────────────────────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "SW", 1, 9, 0, true, 50}; + [4] = {1001, "SW", 1, 9, 0, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 {5:┌──────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*2 {5:└──────────────────────────────────────┘}| ]]} end - meths.win_close(win, true) + api.nvim_win_close(win, true) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*9 ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ## grid 3 ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*8 ]]} end end) it('it can be resized with messages and cmdheight=1', function() screen:try_resize(40,9) - local buf = meths.create_buf(false,true) - local win = meths.open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=8, col=0, style='minimal', border="single", noautocmd=true}) + local buf = api.nvim_create_buf(false,true) + local win = api.nvim_open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=8, col=0, style='minimal', border="single", noautocmd=true}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*8 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*7 ## grid 3 | ## grid 4 {5:┌────────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*4 {5:└────────────────────────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "SW", 1, 8, 0, true, 50}; + [4] = {1001, "SW", 1, 8, 0, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ ^ | {0:~ }| {5:┌──────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*4 {5:└──────────────────────────────────────┘}| | ]]} @@ -10436,48 +8423,30 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [3:----------------------------------------]| - [3:----------------------------------------]| + [2:----------------------------------------]|*7 + [3:----------------------------------------]|*2 ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*7 ## grid 3 | {8:Press ENTER or type command to continue}^ | ## grid 4 {5:┌────────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*4 {5:└────────────────────────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "SW", 1, 8, 0, true, 50}; + [4] = {1001, "SW", 1, 8, 0, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ | {0:~ }| {5:┌──────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*3 {4: }| | {8:Press ENTER or type command to continue}^ | @@ -10488,88 +8457,52 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*8 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*7 ## grid 3 | ## grid 4 {5:┌────────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*2 {5:└────────────────────────────────────────┘}| ]], float_pos={ - [4] = {{id = 1001}, "SW", 1, 8, 0, true, 50}; + [4] = {1001, "SW", 1, 8, 0, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ ^ | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {5:┌──────────────────────────────────────┐}| - {5:│}{1: }{5:│}| - {5:│}{1: }{5:│}| + {5:│}{1: }{5:│}|*2 {5:└──────────────────────────────────────┘}| | ]]} end - meths.win_close(win, true) + api.nvim_win_close(win, true) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*8 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*7 ## grid 3 | ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*7 | ]]} end @@ -10578,9 +8511,9 @@ describe('float window', function() describe('no crash after moving and closing float window #21547', function() local function test_float_move_close(cmd) local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10} - meths.open_win(meths.create_buf(false, false), true, float_opts) + api.nvim_open_win(api.nvim_create_buf(false, false), true, float_opts) if multigrid then - screen:expect({float_pos = {[4] = {{id = 1001}, 'NW', 1, 1, 1, true}}}) + screen:expect({float_pos = {[4] = {1001, 'NW', 1, 1, 1, true}}}) end command(cmd) exec_lua([[ @@ -10605,26 +8538,17 @@ describe('float window', function() it(':sleep cursor placement #22639', function() local float_opts = {relative = 'editor', row = 1, col = 1, width = 4, height = 3} - local win = meths.open_win(meths.create_buf(false, false), true, float_opts) + local win = api.nvim_open_win(api.nvim_create_buf(false, false), true, float_opts) feed('iab<CR>cd<Esc>') feed(':sleep 100') if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :sleep 100^ | ## grid 4 @@ -10632,10 +8556,10 @@ describe('float window', function() {1:cd }| {2:~ }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50}; + [4] = {1001, "NW", 1, 1, 1, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10643,8 +8567,7 @@ describe('float window', function() {0:~}{1:ab }{0: }| {0:~}{1:cd }{0: }| {0:~}{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 :sleep 100^ | ]]} end @@ -10653,20 +8576,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :sleep 100 | ## grid 4 @@ -10674,10 +8588,10 @@ describe('float window', function() {1:c^d }| {2:~ }| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50}; + [4] = {1001, "NW", 1, 1, 1, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10685,33 +8599,23 @@ describe('float window', function() {0:~}{1:ab }{0: }| {0:~}{1:c^d }{0: }| {0:~}{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 :sleep 100 | ]]} end feed('<C-C>') screen:expect_unchanged() - meths.win_set_config(win, {border = 'single'}) + api.nvim_win_set_config(win, {border = 'single'}) feed(':sleep 100') if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :sleep 100^ | ## grid 4 @@ -10721,10 +8625,10 @@ describe('float window', function() {5:│}{2:~ }{5:│}| {5:└────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50}; + [4] = {1001, "NW", 1, 1, 1, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10742,20 +8646,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :sleep 100 | ## grid 4 @@ -10765,10 +8660,10 @@ describe('float window', function() {5:│}{2:~ }{5:│}| {5:└────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50}; + [4] = {1001, "NW", 1, 1, 1, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10789,20 +8684,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :sleep 100^ | ## grid 4 @@ -10812,10 +8698,10 @@ describe('float window', function() {5:│}{1:cd }{5:│}| {5:└────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50}; + [4] = {1001, "NW", 1, 1, 1, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10833,20 +8719,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 :sleep 100 | ## grid 4 @@ -10856,10 +8733,10 @@ describe('float window', function() {5:│}{1:c^d }{5:│}| {5:└────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50}; + [4] = {1001, "NW", 1, 1, 1, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10878,26 +8755,17 @@ describe('float window', function() it('with rightleft and border #22640', function() local float_opts = {relative='editor', width=5, height=3, row=1, col=1, border='single'} - meths.open_win(meths.create_buf(false, false), true, float_opts) + api.nvim_open_win(api.nvim_create_buf(false, false), true, float_opts) command('setlocal rightleft') feed('iabc<CR>def<Esc>') if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 @@ -10907,10 +8775,10 @@ describe('float window', function() {5:│}{2: ~}{5:│}| {5:└─────┘}| ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50}; + [4] = {1001, "NW", 1, 1, 1, true, 50}; }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -10926,29 +8794,20 @@ describe('float window', function() end) it('float window with hide option', function() - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, false, {relative='editor', width=10, height=2, row=2, col=5, hide = true}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, false, {relative='editor', width=10, height=2, row=2, col=5, hide = true}) local expected_pos = { - [4]={{id=1001}, 'NW', 1, 2, 5, true}, + [4]={1001, 'NW', 1, 2, 5, true}, } if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | @@ -10959,33 +8818,20 @@ describe('float window', function() else screen:expect([[ ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end - meths.win_set_config(win, {hide = false}) + api.nvim_win_set_config(win, {hide = false}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | @@ -10999,30 +8845,20 @@ describe('float window', function() {0:~ }| {0:~ }{1: }{0: }| {0:~ }{2:~ }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 | ]]) end - meths.win_set_config(win, {hide=true}) + api.nvim_win_set_config(win, {hide=true}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | @@ -11033,85 +8869,55 @@ describe('float window', function() else screen:expect([[ ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end end) it(':fclose command #9663', function() - local buf_a = meths.create_buf(false,false) - local buf_b = meths.create_buf(false,false) - local buf_c = meths.create_buf(false,false) - local buf_d = meths.create_buf(false,false) + local buf_a = api.nvim_create_buf(false,false) + local buf_b = api.nvim_create_buf(false,false) + local buf_c = api.nvim_create_buf(false,false) + local buf_d = api.nvim_create_buf(false,false) local config_a = {relative='editor', width=11, height=11, row=5, col=5, border ='single', zindex=50} local config_b = {relative='editor', width=8, height=8, row=7, col=7, border ='single', zindex=70} local config_c = {relative='editor', width=4, height=4, row=9, col=9, border ='single',zindex=90} local config_d = {relative='editor', width=2, height=2, row=10, col=10, border ='single',zindex=100} - meths.open_win(buf_a, false, config_a) - meths.open_win(buf_b, false, config_b) - meths.open_win(buf_c, false, config_c) - meths.open_win(buf_d, false, config_d) + api.nvim_open_win(buf_a, false, config_a) + api.nvim_open_win(buf_b, false, config_b) + api.nvim_open_win(buf_c, false, config_c) + api.nvim_open_win(buf_d, false, config_d) local expected_pos = { - [4]={{id=1001}, 'NW', 1, 5, 5, true, 50}, - [5]={{id=1002}, 'NW', 1, 7, 7, true, 70}, - [6]={{id=1003}, 'NW', 1, 9, 9, true, 90}, - [7]={{id=1004}, 'NW', 1, 10, 10, true, 100}, + [4]={1001, 'NW', 1, 5, 5, true, 50}, + [5]={1002, 'NW', 1, 7, 7, true, 70}, + [6]={1003, 'NW', 1, 9, 9, true, 90}, + [7]={1004, 'NW', 1, 10, 10, true, 100}, } if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {5:┌───────────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*10 {5:└───────────┘}| ## grid 5 {5:┌────────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*7 {5:└────────┘}| ## grid 6 {5:┌────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*3 {5:└────┘}| ## grid 7 {5:┌──┐}| @@ -11136,63 +8942,35 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {5:┌───────────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*10 {5:└───────────┘}| ## grid 5 {5:┌────────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*7 {5:└────────┘}| ## grid 6 {5:┌────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*3 {5:└────┘}| ]], float_pos=expected_pos} else screen:expect([[ ^ {5:┌─┌─┌────┐─┐┐} | {0:~ }{5:│}{1: }{5:│}{1: }{5:│}{1: }{5:│}{1: }{5:││}{0: }| - {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }| - {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }| - {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }|*3 {0:~ }{5:│}{2:~}{5:│}{2:~}{5:└────┘}{2: }{5:││}{0: }| | ]]) @@ -11203,57 +8981,30 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | ## grid 4 {5:┌───────────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*10 {5:└───────────┘}| ## grid 5 {5:┌────────┐}| {5:│}{1: }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| - {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}|*7 {5:└────────┘}| ]], float_pos=expected_pos} else screen:expect([[ ^ {5:┌─┌────────┐┐} | {0:~ }{5:│}{1: }{5:│}{1: }{5:││}{0: }| - {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }| - {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }| - {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }| - {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }| + {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }|*4 | ]]) end @@ -11262,20 +9013,11 @@ describe('float window', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 ## grid 3 | @@ -11283,15 +9025,82 @@ describe('float window', function() else screen:expect([[ ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) end end) + + it('correctly placed in or above message area', function() + local float_opts = {relative='editor', width=5, height=1, row=100, col=1, border = 'single'} + api.nvim_set_option_value('cmdheight', 3, {}) + command("echo 'cmdline'") + local win = api.nvim_open_win(api.nvim_create_buf(false, false), true, float_opts) + -- Not hidden behind message area but placed above it. + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]|*4 + [3:----------------------------------------]|*3 + ## grid 2 + | + {0:~ }|*3 + ## grid 3 + cmdline | + |*2 + ## grid 4 + {5:┌─────┐}| + {5:│}{1:^ }{5:│}| + {5:└─────┘}| + ]], float_pos={ + [4] = {1001, "NW", 1, 100, 1, true, 50}; + }, win_viewport={ + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + }} + else + screen:expect{grid=[[ + | + {0:~}{5:┌─────┐}{0: }| + {0:~}{5:│}{1:^ }{5:│}{0: }| + {0:~}{5:└─────┘}{0: }| + cmdline | + |*2 + ]]} + end + -- Not placed above message area and visible on top of it. + api.nvim_win_set_config(win, {zindex = 300}) + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]|*4 + [3:----------------------------------------]|*3 + ## grid 2 + | + {0:~ }|*3 + ## grid 3 + cmdline | + |*2 + ## grid 4 + {5:┌─────┐}| + {5:│}{1:^ }{5:│}| + {5:└─────┘}| + ]], float_pos={ + [4] = {1001, "NW", 1, 100, 1, true, 300}; + }, win_viewport={ + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + }} + else + screen:expect{grid=[[ + | + {0:~ }|*3 + c{5:┌─────┐} | + {5:│}{1:^ }{5:│} | + {5:└─────┘} | + ]]} + end + end) end describe('with ext_multigrid', function() |