mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
test: use integers for API Buffer/Window/Tabpage EXT types
This commit is contained in:
parent
91dc04a5e1
commit
8f02ae82e2
@ -1,22 +1,5 @@
|
||||
local mpack = vim.mpack
|
||||
|
||||
-- temporary hack to be able to manipulate buffer/window/tabpage
|
||||
local Buffer = {}
|
||||
Buffer.__index = Buffer
|
||||
function Buffer.new(id)
|
||||
return setmetatable({ id = id }, Buffer)
|
||||
end
|
||||
local Window = {}
|
||||
Window.__index = Window
|
||||
function Window.new(id)
|
||||
return setmetatable({ id = id }, Window)
|
||||
end
|
||||
local Tabpage = {}
|
||||
Tabpage.__index = Tabpage
|
||||
function Tabpage.new(id)
|
||||
return setmetatable({ id = id }, Tabpage)
|
||||
end
|
||||
|
||||
local Response = {}
|
||||
Response.__index = Response
|
||||
|
||||
@ -45,30 +28,21 @@ MsgpackRpcStream.__index = MsgpackRpcStream
|
||||
function MsgpackRpcStream.new(stream)
|
||||
return setmetatable({
|
||||
_stream = stream,
|
||||
_pack = mpack.Packer({
|
||||
ext = {
|
||||
[Buffer] = function(o)
|
||||
return 0, mpack.encode(o.id)
|
||||
end,
|
||||
[Window] = function(o)
|
||||
return 1, mpack.encode(o.id)
|
||||
end,
|
||||
[Tabpage] = function(o)
|
||||
return 2, mpack.encode(o.id)
|
||||
end,
|
||||
},
|
||||
}),
|
||||
_pack = mpack.Packer(),
|
||||
_session = mpack.Session({
|
||||
unpack = mpack.Unpacker({
|
||||
ext = {
|
||||
-- Buffer
|
||||
[0] = function(_c, s)
|
||||
return Buffer.new(mpack.decode(s))
|
||||
return mpack.decode(s)
|
||||
end,
|
||||
-- Window
|
||||
[1] = function(_c, s)
|
||||
return Window.new(mpack.decode(s))
|
||||
return mpack.decode(s)
|
||||
end,
|
||||
-- Tabpage
|
||||
[2] = function(_c, s)
|
||||
return Tabpage.new(mpack.decode(s))
|
||||
return mpack.decode(s)
|
||||
end,
|
||||
},
|
||||
}),
|
||||
|
@ -733,7 +733,7 @@ describe('api/buf', function()
|
||||
end)
|
||||
|
||||
it('set_lines on unloaded buffer #8659 #22670', function()
|
||||
local bufnr = api.nvim_get_current_buf().id
|
||||
local bufnr = api.nvim_get_current_buf()
|
||||
lua_or_rpc.nvim_buf_set_lines(bufnr, 0, -1, false, { 'a', 'b', 'c' })
|
||||
lua_or_rpc.nvim_buf_set_name(bufnr, 'set_lines')
|
||||
finally(function()
|
||||
@ -2101,7 +2101,7 @@ describe('api/buf', function()
|
||||
api.nvim_buf_set_lines(0, -1, -1, true, { 'a', 'bit of', 'text' })
|
||||
eq(true, api.nvim_buf_set_mark(0, 'Z', 3, 2, {}))
|
||||
eq({ 3, 2 }, api.nvim_buf_get_mark(0, 'Z'))
|
||||
eq({ api.nvim_get_current_buf().id, 3, 3, 0 }, fn.getpos("'Z"))
|
||||
eq({ api.nvim_get_current_buf(), 3, 3, 0 }, fn.getpos("'Z"))
|
||||
end)
|
||||
it('fails when invalid marks names are used', function()
|
||||
eq(false, pcall(api.nvim_buf_set_mark, 0, '!', 1, 0, {}))
|
||||
|
@ -820,7 +820,7 @@ describe('API: buffer events:', function()
|
||||
[1] = 'notification',
|
||||
[2] = 'nvim_buf_changedtick_event',
|
||||
[3] = {
|
||||
[1] = { id = 1 },
|
||||
[1] = 1,
|
||||
[2] = 2,
|
||||
},
|
||||
}, next_msg())
|
||||
|
@ -1895,7 +1895,7 @@ describe('API/win_extmark', function()
|
||||
extmarks = {
|
||||
[2] = {
|
||||
-- positioned at the end of the 2nd line
|
||||
{ { id = 1000 }, ns, marks[1], 1, 16 },
|
||||
{ 1000, ns, marks[1], 1, 16 },
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -1921,27 +1921,27 @@ describe('API/win_extmark', function()
|
||||
extmarks = {
|
||||
[2] = {
|
||||
-- notification from 1st call
|
||||
{ { id = 1000 }, ns, marks[1], 1, 0 },
|
||||
{ 1000, ns, marks[1], 1, 0 },
|
||||
-- notifications from 2nd call
|
||||
{ { id = 1000 }, ns, marks[1], 1, 0 },
|
||||
{ { id = 1000 }, ns, marks[2], 1, 2 },
|
||||
{ 1000, ns, marks[1], 1, 0 },
|
||||
{ 1000, ns, marks[2], 1, 2 },
|
||||
-- notifications from 3rd call
|
||||
{ { id = 1000 }, ns, marks[1], 1, 0 },
|
||||
{ { id = 1000 }, ns, marks[2], 1, 2 },
|
||||
{ { id = 1000 }, ns, marks[3], 1, 4 },
|
||||
{ 1000, ns, marks[1], 1, 0 },
|
||||
{ 1000, ns, marks[2], 1, 2 },
|
||||
{ 1000, ns, marks[3], 1, 4 },
|
||||
-- notifications from 4th call
|
||||
{ { id = 1000 }, ns, marks[1], 1, 0 },
|
||||
{ { id = 1000 }, ns, marks[2], 1, 2 },
|
||||
{ { id = 1000 }, ns, marks[3], 1, 4 },
|
||||
{ { id = 1000 }, ns, marks[4], 1, 6 },
|
||||
{ 1000, ns, marks[1], 1, 0 },
|
||||
{ 1000, ns, marks[2], 1, 2 },
|
||||
{ 1000, ns, marks[3], 1, 4 },
|
||||
{ 1000, ns, marks[4], 1, 6 },
|
||||
-- final
|
||||
-- overlay
|
||||
{ { id = 1000 }, ns, marks[1], 1, 0 },
|
||||
{ { id = 1000 }, ns, marks[2], 1, 2 },
|
||||
{ { id = 1000 }, ns, marks[3], 1, 4 },
|
||||
{ { id = 1000 }, ns, marks[4], 1, 6 },
|
||||
{ 1000, ns, marks[1], 1, 0 },
|
||||
{ 1000, ns, marks[2], 1, 2 },
|
||||
{ 1000, ns, marks[3], 1, 4 },
|
||||
{ 1000, ns, marks[4], 1, 6 },
|
||||
-- eol
|
||||
{ { id = 1000 }, ns, marks[5], 2, 11 },
|
||||
{ 1000, ns, marks[5], 2, 11 },
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -1966,9 +1966,9 @@ describe('API/win_extmark', function()
|
||||
extmarks = {
|
||||
[2] = {
|
||||
-- positioned at the end of the 2nd line
|
||||
{ { id = 1000 }, ns, marks[1], 1, 16 },
|
||||
{ 1000, ns, marks[1], 1, 16 },
|
||||
-- updated and wrapped to 3rd line
|
||||
{ { id = 1000 }, ns, marks[1], 2, 2 },
|
||||
{ 1000, ns, marks[1], 2, 2 },
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -1983,9 +1983,9 @@ describe('API/win_extmark', function()
|
||||
extmarks = {
|
||||
[2] = {
|
||||
-- positioned at the end of the 2nd line
|
||||
{ { id = 1000 }, ns, marks[1], 1, 16 },
|
||||
{ 1000, ns, marks[1], 1, 16 },
|
||||
-- updated and wrapped to 3rd line
|
||||
{ { id = 1000 }, ns, marks[1], 2, 2 },
|
||||
{ 1000, ns, marks[1], 2, 2 },
|
||||
-- scrolled up one line, should be handled by grid scroll
|
||||
},
|
||||
},
|
||||
@ -2021,13 +2021,13 @@ describe('API/win_extmark', function()
|
||||
extmarks = {
|
||||
[2] = {
|
||||
-- positioned at the end of the 2nd line
|
||||
{ { id = 1000 }, ns, marks[1], 1, 16 },
|
||||
{ 1000, ns, marks[1], 1, 16 },
|
||||
-- updated after split
|
||||
{ { id = 1000 }, ns, marks[1], 1, 16 },
|
||||
{ 1000, ns, marks[1], 1, 16 },
|
||||
},
|
||||
[4] = {
|
||||
-- only after split
|
||||
{ { id = 1001 }, ns, marks[1], 1, 16 },
|
||||
{ 1001, ns, marks[1], 1, 16 },
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -2054,14 +2054,14 @@ describe('API/win_extmark', function()
|
||||
extmarks = {
|
||||
[2] = {
|
||||
-- positioned at the end of the 2nd line
|
||||
{ { id = 1000 }, ns, marks[1], 1, 16 },
|
||||
{ 1000, ns, marks[1], 1, 16 },
|
||||
-- updated after split
|
||||
{ { id = 1000 }, ns, marks[1], 1, 16 },
|
||||
{ 1000, ns, marks[1], 1, 16 },
|
||||
},
|
||||
[4] = {
|
||||
{ { id = 1001 }, ns, marks[1], 1, 16 },
|
||||
{ 1001, ns, marks[1], 1, 16 },
|
||||
-- updated
|
||||
{ { id = 1001 }, ns, marks[1], 2, 2 },
|
||||
{ 1001, ns, marks[1], 2, 2 },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
@ -1697,19 +1697,20 @@ describe('API', function()
|
||||
|
||||
it('get buffer or window-local options', function()
|
||||
command('new')
|
||||
local buf = api.nvim_get_current_buf().id
|
||||
local buf = api.nvim_get_current_buf()
|
||||
api.nvim_set_option_value('tagfunc', 'foobar', { buf = buf })
|
||||
eq('foobar', api.nvim_get_option_value('tagfunc', { buf = buf }))
|
||||
|
||||
local win = api.nvim_get_current_win().id
|
||||
local win = api.nvim_get_current_win()
|
||||
api.nvim_set_option_value('number', true, { win = win })
|
||||
eq(true, api.nvim_get_option_value('number', { win = win }))
|
||||
end)
|
||||
|
||||
it('getting current buffer option does not adjust cursor #19381', function()
|
||||
command('new')
|
||||
local buf = api.nvim_get_current_buf().id
|
||||
local win = api.nvim_get_current_win().id
|
||||
local buf = api.nvim_get_current_buf()
|
||||
print(vim.inspect(api.nvim_get_current_buf()))
|
||||
local win = api.nvim_get_current_win()
|
||||
insert('some text')
|
||||
feed('0v$')
|
||||
eq({ 1, 9 }, api.nvim_win_get_cursor(win))
|
||||
@ -2503,7 +2504,7 @@ describe('API', function()
|
||||
|
||||
it('stream=job :terminal channel', function()
|
||||
command(':terminal')
|
||||
eq({ id = 1 }, api.nvim_get_current_buf())
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
eq(3, api.nvim_get_option_value('channel', { buf = 1 }))
|
||||
|
||||
local info = {
|
||||
@ -2520,7 +2521,7 @@ describe('API', function()
|
||||
neq(nil, string.match(info.pty, '^/dev/'))
|
||||
end
|
||||
eq({ info = info }, event)
|
||||
info.buffer = { id = 1 }
|
||||
info.buffer = 1
|
||||
eq({ [1] = testinfo, [2] = stderr, [3] = info }, api.nvim_list_chans())
|
||||
eq(info, api.nvim_get_chan_info(3))
|
||||
|
||||
@ -2989,15 +2990,15 @@ describe('API', function()
|
||||
|
||||
describe('nvim_create_buf', function()
|
||||
it('works', function()
|
||||
eq({ id = 2 }, api.nvim_create_buf(true, false))
|
||||
eq({ id = 3 }, api.nvim_create_buf(false, false))
|
||||
eq(2, api.nvim_create_buf(true, false))
|
||||
eq(3, api.nvim_create_buf(false, false))
|
||||
eq(
|
||||
' 1 %a "[No Name]" line 1\n'
|
||||
.. ' 2 h "[No Name]" line 0',
|
||||
command_output('ls')
|
||||
)
|
||||
-- current buffer didn't change
|
||||
eq({ id = 1 }, api.nvim_get_current_buf())
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
|
||||
local screen = Screen.new(20, 4)
|
||||
screen:attach()
|
||||
@ -3017,21 +3018,21 @@ describe('API', function()
|
||||
|
||||
it('can change buftype before visiting', function()
|
||||
api.nvim_set_option_value('hidden', false, {})
|
||||
eq({ id = 2 }, api.nvim_create_buf(true, false))
|
||||
eq(2, api.nvim_create_buf(true, false))
|
||||
api.nvim_set_option_value('buftype', 'nofile', { buf = 2 })
|
||||
api.nvim_buf_set_lines(2, 0, -1, true, { 'test text' })
|
||||
command('split | buffer 2')
|
||||
eq({ id = 2 }, api.nvim_get_current_buf())
|
||||
eq(2, api.nvim_get_current_buf())
|
||||
-- if the buf_set_option("buftype") didn't work, this would error out.
|
||||
command('close')
|
||||
eq({ id = 1 }, api.nvim_get_current_buf())
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
end)
|
||||
|
||||
it('does not trigger BufEnter, BufWinEnter', function()
|
||||
command('let g:fired = v:false')
|
||||
command('au BufEnter,BufWinEnter * let g:fired = v:true')
|
||||
|
||||
eq({ id = 2 }, api.nvim_create_buf(true, false))
|
||||
eq(2, api.nvim_create_buf(true, false))
|
||||
api.nvim_buf_set_lines(2, 0, -1, true, { 'test', 'text' })
|
||||
|
||||
eq(false, eval('g:fired'))
|
||||
@ -3050,9 +3051,9 @@ describe('API', function()
|
||||
end)
|
||||
|
||||
it('scratch-buffer', function()
|
||||
eq({ id = 2 }, api.nvim_create_buf(false, true))
|
||||
eq({ id = 3 }, api.nvim_create_buf(true, true))
|
||||
eq({ id = 4 }, api.nvim_create_buf(true, true))
|
||||
eq(2, api.nvim_create_buf(false, true))
|
||||
eq(3, api.nvim_create_buf(true, true))
|
||||
eq(4, api.nvim_create_buf(true, true))
|
||||
local scratch_bufs = { 2, 3, 4 }
|
||||
eq(
|
||||
' 1 %a "[No Name]" line 1\n'
|
||||
@ -3061,7 +3062,7 @@ describe('API', function()
|
||||
exec_capture('ls')
|
||||
)
|
||||
-- current buffer didn't change
|
||||
eq({ id = 1 }, api.nvim_get_current_buf())
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
|
||||
local screen = Screen.new(20, 4)
|
||||
screen:set_default_attr_ids({
|
||||
@ -3295,13 +3296,13 @@ describe('API', function()
|
||||
bufs = api.nvim_list_bufs()
|
||||
wins = api.nvim_list_wins()
|
||||
|
||||
api.nvim_win_set_buf(wins[1].id, bufs[1].id)
|
||||
api.nvim_win_set_buf(wins[2].id, bufs[2].id)
|
||||
api.nvim_win_set_buf(wins[1], bufs[1])
|
||||
api.nvim_win_set_buf(wins[2], bufs[2])
|
||||
|
||||
api.nvim_set_current_win(wins[2].id)
|
||||
api.nvim_set_current_win(wins[2])
|
||||
api.nvim_exec('source ' .. fname, false)
|
||||
|
||||
api.nvim_set_current_win(wins[1].id)
|
||||
api.nvim_set_current_win(wins[1])
|
||||
end)
|
||||
|
||||
after_each(function()
|
||||
@ -3343,7 +3344,7 @@ describe('API', function()
|
||||
for _, t in pairs(tests) do
|
||||
it(t.desc, function()
|
||||
-- Switch to the target buffer/window so that curbuf/curwin are used.
|
||||
api.nvim_set_current_win(wins[2].id)
|
||||
api.nvim_set_current_win(wins[2])
|
||||
local info = api.nvim_get_option_info2(unpack(t.args))
|
||||
eq(t.linenr, info.last_set_linenr)
|
||||
eq(t.sid, info.last_set_sid)
|
||||
@ -3351,13 +3352,13 @@ describe('API', function()
|
||||
end
|
||||
|
||||
it('is provided for cross-buffer requests', function()
|
||||
local info = api.nvim_get_option_info2('formatprg', { buf = bufs[2].id })
|
||||
local info = api.nvim_get_option_info2('formatprg', { buf = bufs[2] })
|
||||
eq(2, info.last_set_linenr)
|
||||
eq(1, info.last_set_sid)
|
||||
end)
|
||||
|
||||
it('is provided for cross-window requests', function()
|
||||
local info = api.nvim_get_option_info2('listchars', { win = wins[2].id })
|
||||
local info = api.nvim_get_option_info2('listchars', { win = wins[2] })
|
||||
eq(6, info.last_set_linenr)
|
||||
eq(1, info.last_set_sid)
|
||||
end)
|
||||
@ -3597,7 +3598,7 @@ describe('API', function()
|
||||
local mark = api.nvim_get_mark('F', {})
|
||||
-- Compare the path tail only
|
||||
assert(string.find(mark[4], 'mybuf$'))
|
||||
eq({ 2, 2, buf.id, mark[4] }, mark)
|
||||
eq({ 2, 2, buf, mark[4] }, mark)
|
||||
end)
|
||||
it('validation', function()
|
||||
eq("Invalid mark name (must be file/uppercase): 'f'", pcall_err(api.nvim_get_mark, 'f', {}))
|
||||
@ -3619,7 +3620,7 @@ describe('API', function()
|
||||
|
||||
api.nvim_buf_set_mark(buf, 'F', 2, 2, {})
|
||||
command('new') -- Create new buf to avoid :bd failing
|
||||
command('bd! ' .. buf.id)
|
||||
command('bd! ' .. buf)
|
||||
os.remove(fname)
|
||||
|
||||
local mark = api.nvim_get_mark('F', {})
|
||||
@ -3628,7 +3629,7 @@ describe('API', function()
|
||||
local tail_patt = [[[\/][^\/]*$]]
|
||||
-- tail of paths should be equals
|
||||
eq(fname:match(tail_patt), mfname:match(tail_patt))
|
||||
eq({ 2, 2, buf.id, mark[4] }, mark)
|
||||
eq({ 2, 2, buf, mark[4] }, mark)
|
||||
end)
|
||||
end)
|
||||
describe('nvim_eval_statusline', function()
|
||||
@ -3743,7 +3744,7 @@ describe('API', function()
|
||||
},
|
||||
api.nvim_eval_statusline(
|
||||
'TextWithNoHighlight%#WarningMsg#TextWithWarningHighlight',
|
||||
{ winid = api.nvim_list_wins()[2].id, highlights = true }
|
||||
{ winid = api.nvim_list_wins()[2], highlights = true }
|
||||
)
|
||||
)
|
||||
end)
|
||||
@ -4824,7 +4825,7 @@ describe('API', function()
|
||||
it('works', function()
|
||||
command('vsplit | enew')
|
||||
api.nvim_cmd({ cmd = 'bdelete', args = { api.nvim_get_current_buf() } }, {})
|
||||
eq(1, api.nvim_get_current_buf().id)
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
end)
|
||||
it('works with :sleep using milliseconds', function()
|
||||
local start = uv.now()
|
||||
|
@ -428,11 +428,11 @@ describe('API/win', function()
|
||||
command('tabnew')
|
||||
local tab1 = unpack(api.nvim_list_tabpages())
|
||||
local win1 = unpack(api.nvim_tabpage_list_wins(tab1))
|
||||
api.nvim_set_option_value('statusline', 'window-status', { win = win1.id })
|
||||
api.nvim_set_option_value('statusline', 'window-status', { win = win1 })
|
||||
command('split')
|
||||
command('wincmd J')
|
||||
command('wincmd j')
|
||||
eq('window-status', api.nvim_get_option_value('statusline', { win = win1.id }))
|
||||
eq('window-status', api.nvim_get_option_value('statusline', { win = win1 }))
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
@ -575,7 +575,7 @@ describe('API/win', function()
|
||||
it('closing current (float) window of another tabpage #15313', function()
|
||||
command('tabedit')
|
||||
command('botright split')
|
||||
local prevwin = curwin().id
|
||||
local prevwin = curwin()
|
||||
eq(2, eval('tabpagenr()'))
|
||||
local win = api.nvim_open_win(0, true, {
|
||||
relative = 'editor',
|
||||
@ -589,7 +589,7 @@ describe('API/win', function()
|
||||
eq(1, eval('tabpagenr()'))
|
||||
api.nvim_win_close(win, false)
|
||||
|
||||
eq(prevwin, api.nvim_tabpage_get_win(tab).id)
|
||||
eq(prevwin, api.nvim_tabpage_get_win(tab))
|
||||
assert_alive()
|
||||
end)
|
||||
end)
|
||||
@ -627,7 +627,7 @@ describe('API/win', function()
|
||||
it('deletes the buffer when bufhidden=wipe', function()
|
||||
local oldwin = api.nvim_get_current_win()
|
||||
local oldbuf = api.nvim_get_current_buf()
|
||||
local buf = api.nvim_create_buf(true, false).id
|
||||
local buf = api.nvim_create_buf(true, false)
|
||||
local newwin = api.nvim_open_win(buf, true, {
|
||||
relative = 'win',
|
||||
row = 3,
|
||||
|
@ -45,7 +45,7 @@ describe('WinScrolled', function()
|
||||
local win_id
|
||||
|
||||
before_each(function()
|
||||
win_id = api.nvim_get_current_win().id
|
||||
win_id = api.nvim_get_current_win()
|
||||
command(string.format('autocmd WinScrolled %d let g:matched = v:true', win_id))
|
||||
exec([[
|
||||
let g:scrolled = 0
|
||||
@ -313,7 +313,7 @@ describe('WinScrolled', function()
|
||||
style = 'minimal',
|
||||
})
|
||||
screen:expect({ any = '@' })
|
||||
local winid_str = tostring(win.id)
|
||||
local winid_str = tostring(win)
|
||||
-- WinScrolled should not be triggered when creating a new floating window
|
||||
eq(0, eval('g:scrolled'))
|
||||
|
||||
@ -327,7 +327,7 @@ describe('WinScrolled', function()
|
||||
|
||||
api.nvim_input_mouse('wheel', 'up', '', 0, 3, 3)
|
||||
eq(2, eval('g:scrolled'))
|
||||
eq(tostring(win.id), eval('g:amatch'))
|
||||
eq(tostring(win), eval('g:amatch'))
|
||||
eq({
|
||||
all = { leftcol = 0, topline = 3, topfill = 0, width = 0, height = 0, skipcol = 0 },
|
||||
[winid_str] = { leftcol = 0, topline = -3, topfill = 0, width = 0, height = 0, skipcol = 0 },
|
||||
|
@ -104,7 +104,7 @@ describe('named marks', function()
|
||||
feed('mA')
|
||||
command('next')
|
||||
feed("'A")
|
||||
eq(1, api.nvim_get_current_buf().id)
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
eq({ 2, 0 }, cursor())
|
||||
end)
|
||||
|
||||
@ -117,7 +117,7 @@ describe('named marks', function()
|
||||
feed('mA')
|
||||
command('next')
|
||||
feed('`A')
|
||||
eq(1, api.nvim_get_current_buf().id)
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
eq({ 2, 2 }, cursor())
|
||||
end)
|
||||
|
||||
@ -130,7 +130,7 @@ describe('named marks', function()
|
||||
feed('mA')
|
||||
command('next')
|
||||
feed("g'A")
|
||||
eq(1, api.nvim_get_current_buf().id)
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
eq({ 2, 0 }, cursor())
|
||||
end)
|
||||
|
||||
@ -143,7 +143,7 @@ describe('named marks', function()
|
||||
feed('mA')
|
||||
command('next')
|
||||
feed('g`A')
|
||||
eq(1, api.nvim_get_current_buf().id)
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
eq({ 2, 2 }, cursor())
|
||||
end)
|
||||
|
||||
@ -157,7 +157,7 @@ describe('named marks', function()
|
||||
feed('mA')
|
||||
command('next')
|
||||
command("'A")
|
||||
eq(1, api.nvim_get_current_buf().id)
|
||||
eq(1, api.nvim_get_current_buf())
|
||||
eq({ 2, 0 }, cursor())
|
||||
end)
|
||||
|
||||
|
@ -76,25 +76,25 @@ describe('tabpage', function()
|
||||
it('nvim_win_close and nvim_win_hide update tabline #20285', function()
|
||||
eq(1, #api.nvim_list_tabpages())
|
||||
eq({ 1, 1 }, fn.win_screenpos(0))
|
||||
local win1 = curwin().id
|
||||
local win1 = curwin()
|
||||
|
||||
command('tabnew')
|
||||
eq(2, #api.nvim_list_tabpages())
|
||||
eq({ 2, 1 }, fn.win_screenpos(0))
|
||||
local win2 = curwin().id
|
||||
local win2 = curwin()
|
||||
|
||||
api.nvim_win_close(win1, true)
|
||||
eq(win2, curwin().id)
|
||||
eq(win2, curwin())
|
||||
eq(1, #api.nvim_list_tabpages())
|
||||
eq({ 1, 1 }, fn.win_screenpos(0))
|
||||
|
||||
command('tabnew')
|
||||
eq(2, #api.nvim_list_tabpages())
|
||||
eq({ 2, 1 }, fn.win_screenpos(0))
|
||||
local win3 = curwin().id
|
||||
local win3 = curwin()
|
||||
|
||||
api.nvim_win_hide(win2)
|
||||
eq(win3, curwin().id)
|
||||
eq(win3, curwin())
|
||||
eq(1, #api.nvim_list_tabpages())
|
||||
eq({ 1, 1 }, fn.win_screenpos(0))
|
||||
end)
|
||||
|
@ -62,10 +62,10 @@ describe('example', function()
|
||||
-- Use screen:expect{condition=…} to check the result.
|
||||
screen:expect {
|
||||
condition = function()
|
||||
eq({ id = 2 }, event_curtab)
|
||||
eq(2, event_curtab)
|
||||
eq({
|
||||
{ tab = { id = 1 }, name = '[No Name]' },
|
||||
{ tab = { id = 2 }, name = 'foo' },
|
||||
{ tab = 1, name = '[No Name]' },
|
||||
{ tab = 2, name = 'foo' },
|
||||
}, event_tabs)
|
||||
end,
|
||||
}
|
||||
|
@ -3408,7 +3408,7 @@ describe('lua stdlib', function()
|
||||
|
||||
describe('vim.api.nvim_buf_call', function()
|
||||
it('can access buf options', function()
|
||||
local buf1 = api.nvim_get_current_buf().id
|
||||
local buf1 = api.nvim_get_current_buf()
|
||||
local buf2 = exec_lua [[
|
||||
buf2 = vim.api.nvim_create_buf(false, true)
|
||||
return buf2
|
||||
@ -3426,7 +3426,7 @@ describe('lua stdlib', function()
|
||||
|
||||
eq(false, api.nvim_get_option_value('autoindent', { buf = buf1 }))
|
||||
eq(true, api.nvim_get_option_value('autoindent', { buf = buf2 }))
|
||||
eq(buf1, api.nvim_get_current_buf().id)
|
||||
eq(buf1, api.nvim_get_current_buf())
|
||||
eq(buf2, val)
|
||||
end)
|
||||
|
||||
@ -3488,7 +3488,7 @@ describe('lua stdlib', function()
|
||||
describe('vim.api.nvim_win_call', function()
|
||||
it('can access window options', function()
|
||||
command('vsplit')
|
||||
local win1 = api.nvim_get_current_win().id
|
||||
local win1 = api.nvim_get_current_win()
|
||||
command('wincmd w')
|
||||
local win2 = exec_lua [[
|
||||
win2 = vim.api.nvim_get_current_win()
|
||||
@ -3508,7 +3508,7 @@ describe('lua stdlib', function()
|
||||
|
||||
eq('', api.nvim_get_option_value('winhighlight', { win = win1 }))
|
||||
eq('Normal:Normal', api.nvim_get_option_value('winhighlight', { win = win2 }))
|
||||
eq(win1, api.nvim_get_current_win().id)
|
||||
eq(win1, api.nvim_get_current_win())
|
||||
eq(win2, val)
|
||||
end)
|
||||
|
||||
|
@ -322,7 +322,7 @@ describe(':terminal buffer', function()
|
||||
command('split')
|
||||
command('enew')
|
||||
local term = api.nvim_open_term(0, {})
|
||||
local termbuf = api.nvim_get_current_buf().id
|
||||
local termbuf = api.nvim_get_current_buf()
|
||||
|
||||
-- Test that autocommand buffer is associated with the terminal buffer, not the current buffer
|
||||
command('au TermRequest * let g:termbuf = +expand("<abuf>")')
|
||||
|
@ -1543,7 +1543,7 @@ describe('cmdheight=0', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 2,
|
||||
curline = 0,
|
||||
@ -1568,7 +1568,7 @@ describe('cmdheight=0', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 2,
|
||||
curline = 0,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1578,7 +1578,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 5,
|
||||
curline = 0,
|
||||
@ -1616,7 +1616,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 5,
|
||||
curline = 2,
|
||||
@ -1656,7 +1656,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 6,
|
||||
curline = 0,
|
||||
@ -1718,7 +1718,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -1760,7 +1760,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 1,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -1800,7 +1800,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 2,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -1838,7 +1838,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 2,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -1874,7 +1874,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 2,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -1908,7 +1908,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 4,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -1944,7 +1944,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 2,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -1983,7 +1983,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 2,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -2021,7 +2021,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 2,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -2057,7 +2057,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 2,
|
||||
botline = 6,
|
||||
curline = 4,
|
||||
@ -2099,7 +2099,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 3,
|
||||
curline = 0,
|
||||
@ -2108,7 +2108,7 @@ describe('folded lines', function()
|
||||
sum_scroll_delta = 0,
|
||||
},
|
||||
[4] = {
|
||||
win = { id = 1001 },
|
||||
win = 1001,
|
||||
topline = 0,
|
||||
botline = 2,
|
||||
curline = 0,
|
||||
@ -2153,7 +2153,7 @@ describe('folded lines', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 3,
|
||||
curline = 0,
|
||||
@ -2162,7 +2162,7 @@ describe('folded lines', function()
|
||||
sum_scroll_delta = -1,
|
||||
},
|
||||
[4] = {
|
||||
win = { id = 1001 },
|
||||
win = 1001,
|
||||
topline = 0,
|
||||
botline = 2,
|
||||
curline = 0,
|
||||
|
@ -813,7 +813,7 @@ describe('ui/mouse/input', function()
|
||||
it('dragging vertical separator', function()
|
||||
screen:try_resize(45, 5)
|
||||
command('setlocal nowrap')
|
||||
local oldwin = api.nvim_get_current_win().id
|
||||
local oldwin = api.nvim_get_current_win()
|
||||
command('rightbelow vnew')
|
||||
screen:expect([[
|
||||
testing │{0:^$} |
|
||||
@ -1688,7 +1688,7 @@ describe('ui/mouse/input', function()
|
||||
local col = win_col + opts.col
|
||||
api.nvim_input_mouse('left', 'press', '', 0, row, col)
|
||||
local mousepos = fn.getmousepos()
|
||||
eq(float.id, mousepos.winid)
|
||||
eq(float, mousepos.winid)
|
||||
eq(win_row + 1, mousepos.winrow)
|
||||
eq(win_col + 1, mousepos.wincol)
|
||||
local line = 0
|
||||
@ -1723,7 +1723,7 @@ describe('ui/mouse/input', function()
|
||||
local col = win_col + opts.col
|
||||
api.nvim_input_mouse('left', 'press', '', 0, row, col)
|
||||
local mousepos = fn.getmousepos()
|
||||
eq(float.id, mousepos.winid)
|
||||
eq(float, mousepos.winid)
|
||||
eq(win_row + 1, mousepos.winrow)
|
||||
eq(win_col + 1, mousepos.wincol)
|
||||
local line = math.min(win_row + 1, fn.line('$'))
|
||||
|
@ -75,8 +75,8 @@ describe('ext_multigrid', function()
|
||||
{1:~ }|*11
|
||||
]], condition=function()
|
||||
eq({
|
||||
[2] = { win = {id=1000}, startrow = 0, startcol = 27, width = 26, height = 12 },
|
||||
[4] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 }
|
||||
[2] = { win = 1000, startrow = 0, startcol = 27, width = 26, height = 12 },
|
||||
[4] = { win = 1001, startrow = 0, startcol = 0, width = 26, height = 12 }
|
||||
}, screen.win_position)
|
||||
end}
|
||||
command('wincmd l')
|
||||
@ -101,9 +101,9 @@ describe('ext_multigrid', function()
|
||||
{1:~ }|*5
|
||||
]], condition=function()
|
||||
eq({
|
||||
[2] = { win = {id=1000}, startrow = 7, startcol = 27, width = 26, height = 5 },
|
||||
[4] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 },
|
||||
[5] = { win = {id=1002}, startrow = 0, startcol = 27, width = 26, height = 6 }
|
||||
[2] = { win = 1000, startrow = 7, startcol = 27, width = 26, height = 5 },
|
||||
[4] = { win = 1001, startrow = 0, startcol = 0, width = 26, height = 12 },
|
||||
[5] = { win = 1002, startrow = 0, startcol = 27, width = 26, height = 6 }
|
||||
}, screen.win_position)
|
||||
end}
|
||||
command('wincmd h')
|
||||
@ -125,8 +125,8 @@ describe('ext_multigrid', function()
|
||||
{1:~ }|*5
|
||||
]], condition=function()
|
||||
eq({
|
||||
[2] = { win = {id=1000}, startrow = 7, startcol = 0, width = 53, height = 5 },
|
||||
[5] = { win = {id=1002}, startrow = 0, startcol = 0, width = 53, height = 6 }
|
||||
[2] = { win = 1000, startrow = 7, startcol = 0, width = 53, height = 5 },
|
||||
[5] = { win = 1002, startrow = 0, startcol = 0, width = 53, height = 6 }
|
||||
}, screen.win_position)
|
||||
end}
|
||||
end)
|
||||
@ -456,7 +456,7 @@ describe('ext_multigrid', function()
|
||||
it('winwidth() winheight() getwininfo() return inner width and height #19743', function()
|
||||
eq(60, fn.winwidth(0))
|
||||
eq(20, fn.winheight(0))
|
||||
local win_info = fn.getwininfo(curwin().id)[1]
|
||||
local win_info = fn.getwininfo(curwin())[1]
|
||||
eq(60, win_info.width)
|
||||
eq(20, win_info.height)
|
||||
end)
|
||||
@ -616,7 +616,7 @@ describe('ext_multigrid', function()
|
||||
{21: }|
|
||||
{22:~ }|*4
|
||||
]], float_pos={
|
||||
[4] = {{id = 1001}, "SE", 2, 16, 58, true, 50};
|
||||
[4] = {1001, "SE", 2, 16, 58, true, 50};
|
||||
}}
|
||||
end)
|
||||
|
||||
@ -638,7 +638,7 @@ describe('ext_multigrid', function()
|
||||
{24: foo}|
|
||||
{21: bar}|
|
||||
]], float_pos={
|
||||
[4] = {{id = -1}, "NW", 2, 15, 55, false, 100};
|
||||
[4] = {-1, "NW", 2, 15, 55, false, 100};
|
||||
}}
|
||||
feed('<C-E><Esc>')
|
||||
|
||||
@ -660,7 +660,7 @@ describe('ext_multigrid', function()
|
||||
{24: oof}|
|
||||
{21: rab}|
|
||||
]], float_pos={
|
||||
[4] = {{id = -1}, "NW", 2, 16, 45, false, 100};
|
||||
[4] = {-1, "NW", 2, 16, 45, false, 100};
|
||||
}}
|
||||
feed('<C-E><Esc>')
|
||||
|
||||
@ -682,7 +682,7 @@ describe('ext_multigrid', function()
|
||||
{24: undefine }|
|
||||
{21: unplace }|
|
||||
]], float_pos={
|
||||
[4] = {{id = -1}, "SW", 1, 13, 5, false, 250};
|
||||
[4] = {-1, "SW", 1, 13, 5, false, 250};
|
||||
}}
|
||||
end)
|
||||
end)
|
||||
@ -1221,7 +1221,7 @@ describe('ext_multigrid', function()
|
||||
## grid 6
|
||||
{21: Copy }|
|
||||
]], float_pos={
|
||||
[6] = {{id = -1}, "NW", 2, 2, 5, false, 250};
|
||||
[6] = {-1, "NW", 2, 2, 5, false, 250};
|
||||
}}
|
||||
feed('<Down><CR>')
|
||||
screen:expect{grid=[[
|
||||
@ -1295,7 +1295,7 @@ describe('ext_multigrid', function()
|
||||
## grid 6
|
||||
{21: Copy }|
|
||||
]], float_pos={
|
||||
[6] = {{id = -1}, "NW", 4, 1, 63, false, 250};
|
||||
[6] = {-1, "NW", 4, 1, 63, false, 250};
|
||||
}}
|
||||
feed('<Down><CR>')
|
||||
screen:expect{grid=[[
|
||||
@ -1417,7 +1417,7 @@ describe('ext_multigrid', function()
|
||||
## grid 6
|
||||
{21: Copy }|
|
||||
]], float_pos={
|
||||
[6] = {{id = -1}, "SW", 4, 9, 0, false, 250};
|
||||
[6] = {-1, "SW", 4, 9, 0, false, 250};
|
||||
}}
|
||||
feed('<Down><CR>')
|
||||
screen:expect{grid=[[
|
||||
@ -1549,7 +1549,7 @@ describe('ext_multigrid', function()
|
||||
## grid 6
|
||||
{21: Copy }|
|
||||
]], float_pos={
|
||||
[6] = {{id = -1}, "NW", 4, 10, 0, false, 250};
|
||||
[6] = {-1, "NW", 4, 10, 0, false, 250};
|
||||
}}
|
||||
feed('<Down><CR>')
|
||||
screen:expect{grid=[[
|
||||
@ -1632,7 +1632,7 @@ describe('ext_multigrid', function()
|
||||
## 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}
|
||||
}}
|
||||
insert([[
|
||||
Lorem ipsum dolor sit amet, consectetur
|
||||
@ -1662,7 +1662,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11, sum_scroll_delta = 5},
|
||||
[2] = {win = 1000, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11, sum_scroll_delta = 5},
|
||||
}}
|
||||
|
||||
|
||||
@ -1682,7 +1682,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 2},
|
||||
[2] = {win = 1000, topline = 2, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 2},
|
||||
}}
|
||||
|
||||
command("split")
|
||||
@ -1703,8 +1703,8 @@ describe('ext_multigrid', function()
|
||||
reprehenderit in voluptate velit esse cillum |
|
||||
^dolore eu fugiat nulla pariatur. Excepteur sint |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 6},
|
||||
[4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 5},
|
||||
[2] = {win = 1000, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 6},
|
||||
[4] = {win = 1001, topline = 5, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 5},
|
||||
}}
|
||||
|
||||
feed("b")
|
||||
@ -1725,8 +1725,8 @@ describe('ext_multigrid', function()
|
||||
reprehenderit in voluptate velit esse ^cillum |
|
||||
dolore eu fugiat nulla pariatur. Excepteur sint |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 6},
|
||||
[4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38, linecount = 11, sum_scroll_delta = 5},
|
||||
[2] = {win = 1000, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 6},
|
||||
[4] = {win = 1001, topline = 5, botline = 9, curline = 6, curcol = 38, linecount = 11, sum_scroll_delta = 5},
|
||||
}}
|
||||
|
||||
feed("2k")
|
||||
@ -1747,8 +1747,8 @@ describe('ext_multigrid', function()
|
||||
ea commodo consequat. Duis aute irure dolor in |
|
||||
reprehenderit in voluptate velit esse cillum |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 6},
|
||||
[4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11, sum_scroll_delta = 4},
|
||||
[2] = {win = 1000, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 6},
|
||||
[4] = {win = 1001, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11, sum_scroll_delta = 4},
|
||||
}}
|
||||
|
||||
-- handles non-current window
|
||||
@ -1770,8 +1770,8 @@ describe('ext_multigrid', function()
|
||||
ea commodo consequat. Duis aute irure dolor in |
|
||||
reprehenderit in voluptate velit esse cillum |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0},
|
||||
[4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11, sum_scroll_delta = 4},
|
||||
[2] = {win = 1000, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0},
|
||||
[4] = {win = 1001, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11, sum_scroll_delta = 4},
|
||||
}}
|
||||
|
||||
-- sum_scroll_delta works with folds
|
||||
@ -1793,8 +1793,8 @@ describe('ext_multigrid', function()
|
||||
reprehenderit in voluptate velit esse cillum |
|
||||
dolore eu fugiat nulla pariatur. Excepteur sint |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0},
|
||||
[4] = {win = {id = 1001}, topline = 4, botline = 9, curline = 4, curcol = 38, linecount = 11, sum_scroll_delta = 4},
|
||||
[2] = {win = 1000, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0},
|
||||
[4] = {win = 1001, topline = 4, botline = 9, curline = 4, curcol = 38, linecount = 11, sum_scroll_delta = 4},
|
||||
}}
|
||||
|
||||
feed('<c-e>')
|
||||
@ -1815,8 +1815,8 @@ describe('ext_multigrid', function()
|
||||
dolore eu fugiat nulla pariatur. Excepteur sint |
|
||||
occaecat cupidatat non proident, sunt in culpa |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0},
|
||||
[4] = {win = {id = 1001}, topline = 6, botline = 10, curline = 6, curcol = 0, linecount = 11, sum_scroll_delta = 5},
|
||||
[2] = {win = 1000, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0},
|
||||
[4] = {win = 1001, topline = 6, botline = 10, curline = 6, curcol = 0, linecount = 11, sum_scroll_delta = 5},
|
||||
}}
|
||||
|
||||
command('close | 21vsplit | setlocal number smoothscroll')
|
||||
@ -1842,8 +1842,8 @@ describe('ext_multigrid', function()
|
||||
{19: } sed do eiusmod t|
|
||||
{19: }empor |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = 1002, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
}}
|
||||
|
||||
feed('5<C-E>')
|
||||
@ -1869,8 +1869,8 @@ describe('ext_multigrid', function()
|
||||
{19: 4 }Ut enim ad minim |
|
||||
{19: }veniam, quis n{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 1, botline = 4, curline = 1, curcol = 38, linecount = 11, sum_scroll_delta = 5};
|
||||
[2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = 1002, topline = 1, botline = 4, curline = 1, curcol = 38, linecount = 11, sum_scroll_delta = 5};
|
||||
}}
|
||||
|
||||
feed('<C-Y>')
|
||||
@ -1896,8 +1896,8 @@ describe('ext_multigrid', function()
|
||||
{19: }na aliqua. |
|
||||
{19: 4 }Ut enim ad min{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 1, botline = 4, curline = 1, curcol = 38, linecount = 11, sum_scroll_delta = 4};
|
||||
[2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = 1002, topline = 1, botline = 4, curline = 1, curcol = 38, linecount = 11, sum_scroll_delta = 4};
|
||||
}}
|
||||
|
||||
command('set cpoptions+=n')
|
||||
@ -1923,8 +1923,8 @@ describe('ext_multigrid', function()
|
||||
liqua. |
|
||||
{19: 4 }Ut enim ad min{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 1, botline = 4, curline = 1, curcol = 38, linecount = 11, sum_scroll_delta = 4};
|
||||
[2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = 1002, topline = 1, botline = 4, curline = 1, curcol = 38, linecount = 11, sum_scroll_delta = 4};
|
||||
}}
|
||||
|
||||
feed('4<C-E>')
|
||||
@ -1950,8 +1950,8 @@ describe('ext_multigrid', function()
|
||||
mco laboris nisi ut a|
|
||||
liquip ex |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 2, botline = 6, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 8};
|
||||
[2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = 1002, topline = 2, botline = 6, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 8};
|
||||
}}
|
||||
|
||||
feed('2<C-Y>')
|
||||
@ -1977,8 +1977,8 @@ describe('ext_multigrid', function()
|
||||
veniam, quis nostrud |
|
||||
{19: 5 }exercitation u{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 2, botline = 5, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 6};
|
||||
[2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = 1002, topline = 2, botline = 5, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 6};
|
||||
}}
|
||||
|
||||
command('setlocal numberwidth=12')
|
||||
@ -2004,8 +2004,8 @@ describe('ext_multigrid', function()
|
||||
d minim veniam, quis |
|
||||
nostrud |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 2, botline = 5, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 6};
|
||||
[2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = 1002, topline = 2, botline = 5, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 6};
|
||||
}}
|
||||
|
||||
feed('2<C-E>')
|
||||
@ -2031,8 +2031,8 @@ describe('ext_multigrid', function()
|
||||
{19: 5 }exercitat|
|
||||
ion ullamco labori{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 2, botline = 5, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 8};
|
||||
[2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = 1002, topline = 2, botline = 5, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 8};
|
||||
}}
|
||||
|
||||
feed('<C-E>')
|
||||
@ -2058,8 +2058,8 @@ describe('ext_multigrid', function()
|
||||
ion ullamco laboris n|
|
||||
isi ut aliquip ex |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 3, botline = 6, curline = 3, curcol = 36, linecount = 11, sum_scroll_delta = 9};
|
||||
[2] = {win = 1000, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = 1002, topline = 3, botline = 6, curline = 3, curcol = 36, linecount = 11, sum_scroll_delta = 9};
|
||||
}}
|
||||
end)
|
||||
|
||||
@ -2087,7 +2087,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 13, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
|
||||
[2] = {win = 1000, topline = 0, botline = 13, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
|
||||
}}
|
||||
feed('G')
|
||||
screen:expect{grid=[[
|
||||
@ -2111,7 +2111,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 30580, botline = 30592, curline = 30591, curcol = 0, linecount = 30592, sum_scroll_delta = 30580};
|
||||
[2] = {win = 1000, topline = 30580, botline = 30592, curline = 30591, curcol = 0, linecount = 30592, sum_scroll_delta = 30580};
|
||||
}}
|
||||
feed('gg')
|
||||
screen:expect{grid=[[
|
||||
@ -2135,7 +2135,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 13, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
|
||||
[2] = {win = 1000, topline = 0, botline = 13, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
|
||||
}}
|
||||
command('setlocal wrap')
|
||||
screen:expect{grid=[[
|
||||
@ -2159,7 +2159,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 10, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
|
||||
[2] = {win = 1000, topline = 0, botline = 10, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
|
||||
}}
|
||||
feed('G')
|
||||
screen:expect{grid=[[
|
||||
@ -2183,7 +2183,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 30586, botline = 30592, curline = 30591, curcol = 0, linecount = 30592, sum_scroll_delta = 30588};
|
||||
[2] = {win = 1000, topline = 30586, botline = 30592, curline = 30591, curcol = 0, linecount = 30592, sum_scroll_delta = 30588};
|
||||
}}
|
||||
feed('gg')
|
||||
screen:expect{grid=[[
|
||||
@ -2207,7 +2207,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 10, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
|
||||
[2] = {win = 1000, topline = 0, botline = 10, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
|
||||
}}
|
||||
end)
|
||||
|
||||
@ -2224,7 +2224,7 @@ describe('ext_multigrid', function()
|
||||
## 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}
|
||||
}}
|
||||
insert([[
|
||||
Lorem ipsum dolor sit amet, consectetur
|
||||
@ -2254,7 +2254,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11, sum_scroll_delta = 5},
|
||||
[2] = {win = 1000, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11, sum_scroll_delta = 5},
|
||||
}}
|
||||
|
||||
api.nvim_input_mouse('left', 'press', '', 1,5, 1)
|
||||
@ -2276,7 +2276,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
{7:-- VISUAL --} |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 12, curline = 10, curcol = 1, linecount = 11, sum_scroll_delta = 6},
|
||||
[2] = {win = 1000, topline = 6, botline = 12, curline = 10, curcol = 1, linecount = 11, sum_scroll_delta = 6},
|
||||
}}
|
||||
end)
|
||||
|
||||
@ -2298,8 +2298,8 @@ describe('ext_multigrid', function()
|
||||
^ |
|
||||
{1:~ }|*5
|
||||
]], 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};
|
||||
}}
|
||||
|
||||
-- XXX: hack to get notifications. Could use next_msg() also.
|
||||
@ -2328,8 +2328,8 @@ describe('ext_multigrid', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]], 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};
|
||||
}}
|
||||
eq({}, win_pos)
|
||||
|
||||
@ -2350,8 +2350,8 @@ describe('ext_multigrid', function()
|
||||
^ |
|
||||
{1:~ }|*5
|
||||
]], 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};
|
||||
}}
|
||||
eq({}, win_pos)
|
||||
end)
|
||||
|
@ -1209,7 +1209,7 @@ describe('builtin popupmenu', function()
|
||||
{n:hh }{s: }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 2, 2, 0, false, 100 },
|
||||
[5] = { -1, 'NW', 2, 2, 0, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1267,7 +1267,7 @@ describe('builtin popupmenu', function()
|
||||
{n:hh }{s: }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 2, 2, 0, false, 100 },
|
||||
[5] = { -1, 'NW', 2, 2, 0, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1343,7 +1343,7 @@ describe('builtin popupmenu', function()
|
||||
{n:mm }{s: }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'SW', 2, 12, 0, false, 100 },
|
||||
[5] = { -1, 'SW', 2, 12, 0, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1419,7 +1419,7 @@ describe('builtin popupmenu', function()
|
||||
{n:ii }{s: }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'SW', 2, 8, 0, false, 100 },
|
||||
[5] = { -1, 'SW', 2, 8, 0, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1494,7 +1494,7 @@ describe('builtin popupmenu', function()
|
||||
{n:hh }{s: }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'SW', 2, 8, 0, false, 100 },
|
||||
[5] = { -1, 'SW', 2, 8, 0, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1630,8 +1630,8 @@ describe('builtin popupmenu', function()
|
||||
{n:three }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 2, 1, 0, false, 100 },
|
||||
[4] = { { id = 1001 }, 'NW', 1, 1, 15, true, 50 },
|
||||
[5] = { -1, 'NW', 2, 1, 0, false, 100 },
|
||||
[4] = { 1001, 'NW', 1, 1, 15, true, 50 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1671,8 +1671,8 @@ describe('builtin popupmenu', function()
|
||||
{s:three }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 2, 1, 0, false, 100 },
|
||||
[4] = { { id = 1001 }, 'NW', 1, 1, 15, true, 50 },
|
||||
[5] = { -1, 'NW', 2, 1, 0, false, 100 },
|
||||
[4] = { 1001, 'NW', 1, 1, 15, true, 50 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1715,12 +1715,12 @@ describe('builtin popupmenu', function()
|
||||
{n: }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 2, 1, 19, false, 100 },
|
||||
[6] = { { id = 1002 }, 'NW', 1, 1, 1, true, 50 },
|
||||
[5] = { -1, 'NW', 2, 1, 19, false, 100 },
|
||||
[6] = { 1002, 'NW', 1, 1, 1, true, 50 },
|
||||
},
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 2,
|
||||
curline = 0,
|
||||
@ -1729,7 +1729,7 @@ describe('builtin popupmenu', function()
|
||||
sum_scroll_delta = 0,
|
||||
},
|
||||
[6] = {
|
||||
win = { id = 1002 },
|
||||
win = 1002,
|
||||
topline = 0,
|
||||
botline = 2,
|
||||
curline = 0,
|
||||
@ -1811,7 +1811,7 @@ describe('builtin popupmenu', function()
|
||||
{n: aac }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 4, 2, 3, false, 100 },
|
||||
[5] = { -1, 'NW', 4, 2, 3, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1853,7 +1853,7 @@ describe('builtin popupmenu', function()
|
||||
{n: aac }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 2, 3, 1, false, 100 },
|
||||
[5] = { -1, 'NW', 2, 3, 1, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1897,7 +1897,7 @@ describe('builtin popupmenu', function()
|
||||
{n: aaabcdef}|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 2, 3, 11, false, 100 },
|
||||
[5] = { -1, 'NW', 2, 3, 11, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -1942,7 +1942,7 @@ describe('builtin popupmenu', function()
|
||||
{n: aac }{s: }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 2, 4, -1, false, 100 },
|
||||
[5] = { -1, 'NW', 2, 4, -1, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -2476,7 +2476,7 @@ describe('builtin popupmenu', function()
|
||||
{s: }{n: eciohc }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 4, 1, -11, false, 100 },
|
||||
[5] = { -1, 'NW', 4, 1, -11, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -2513,7 +2513,7 @@ describe('builtin popupmenu', function()
|
||||
{s: }{n: eciohc}|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'NW', 4, 2, 4, false, 100 },
|
||||
[5] = { -1, 'NW', 4, 2, 4, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -2580,7 +2580,7 @@ describe('builtin popupmenu', function()
|
||||
{n:jump }{s: }|
|
||||
]],
|
||||
float_pos = {
|
||||
[5] = { { id = -1 }, 'SW', 1, 5, 0, false, 250 },
|
||||
[5] = { -1, 'SW', 1, 5, 0, false, 250 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -3475,7 +3475,7 @@ describe('builtin popupmenu', function()
|
||||
{n: choice}{s: }|
|
||||
]],
|
||||
float_pos = {
|
||||
[4] = { { id = -1 }, 'NW', 2, 1, 24, false, 100 },
|
||||
[4] = { -1, 'NW', 2, 1, 24, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -3514,7 +3514,7 @@ describe('builtin popupmenu', function()
|
||||
{n: thing }|
|
||||
]],
|
||||
float_pos = {
|
||||
[4] = { { id = -1 }, 'NW', 2, 1, 25, false, 100 },
|
||||
[4] = { -1, 'NW', 2, 1, 25, false, 100 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -3565,7 +3565,7 @@ describe('builtin popupmenu', function()
|
||||
## grid 4
|
||||
{n: 哦哦哦哦哦哦哦哦哦>}|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 12, false, 100 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 12, false, 100 } },
|
||||
})
|
||||
else
|
||||
screen:expect([[
|
||||
@ -3602,7 +3602,7 @@ describe('builtin popupmenu', function()
|
||||
{n: 哦哦哦哦哦哦哦哦哦>}{c: }|*2
|
||||
{n: 哦哦哦哦哦哦哦哦哦>}{s: }|*2
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 11, false, 100 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 11, false, 100 } },
|
||||
})
|
||||
else
|
||||
screen:expect([[
|
||||
@ -3644,7 +3644,7 @@ describe('builtin popupmenu', function()
|
||||
{n: bar }|
|
||||
{n: baz }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<RightMouse><4,0>')
|
||||
@ -3674,7 +3674,7 @@ describe('builtin popupmenu', function()
|
||||
{n: bar }|
|
||||
{n: baz }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
|
||||
})
|
||||
else
|
||||
screen:expect([[
|
||||
@ -3703,7 +3703,7 @@ describe('builtin popupmenu', function()
|
||||
{s: bar }|
|
||||
{n: baz }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
|
||||
})
|
||||
else
|
||||
screen:expect([[
|
||||
@ -3755,7 +3755,7 @@ describe('builtin popupmenu', function()
|
||||
{n: bar }|
|
||||
{n: baz }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 3, 19, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 3, 19, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<RightMouse><20,2>')
|
||||
@ -3785,7 +3785,7 @@ describe('builtin popupmenu', function()
|
||||
{n: baz }|
|
||||
]],
|
||||
float_pos = {
|
||||
[4] = { { id = -1 }, 'NW', 2, 1, 17, false, 250 },
|
||||
[4] = { -1, 'NW', 2, 1, 17, false, 250 },
|
||||
},
|
||||
}
|
||||
else
|
||||
@ -3816,7 +3816,7 @@ describe('builtin popupmenu', function()
|
||||
{n: bar }|
|
||||
{n: baz }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 3, 19, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 3, 19, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<RightMouse><20,2>')
|
||||
@ -3869,7 +3869,7 @@ describe('builtin popupmenu', function()
|
||||
{n: bar }|
|
||||
{n: baz }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<RightMouse><4,0>')
|
||||
@ -3899,7 +3899,7 @@ describe('builtin popupmenu', function()
|
||||
{n: bar }|
|
||||
{s: baz }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<RightDrag><6,3>')
|
||||
@ -3954,7 +3954,7 @@ describe('builtin popupmenu', function()
|
||||
{n: bar }|
|
||||
{n: baz }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<RightMouse><4,0>')
|
||||
@ -3985,7 +3985,7 @@ describe('builtin popupmenu', function()
|
||||
{n: bar }|
|
||||
{s: baz }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<MouseMove><6,3>')
|
||||
@ -4047,7 +4047,7 @@ describe('builtin popupmenu', function()
|
||||
^popup menu test |
|
||||
{1:~ }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'SW', 5, 1, 19, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'SW', 5, 1, 19, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<RightMouse><20,4>')
|
||||
@ -4118,7 +4118,7 @@ describe('builtin popupmenu', function()
|
||||
^popup menu test |
|
||||
{1:~ }|
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'SW', 6, 1, 12, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'SW', 6, 1, 12, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<RightMouse><30,4>')
|
||||
@ -4192,7 +4192,7 @@ describe('builtin popupmenu', function()
|
||||
{2:WINBAR }|
|
||||
^popup menu test |
|
||||
]],
|
||||
float_pos = { [4] = { { id = -1 }, 'SW', 6, 1, 12, false, 250 } },
|
||||
float_pos = { [4] = { -1, 'SW', 6, 1, 12, false, 250 } },
|
||||
})
|
||||
else
|
||||
feed('<RightMouse><30,4>')
|
||||
|
@ -1484,9 +1484,9 @@ local function fmt_ext_state(name, state)
|
||||
str
|
||||
.. ' ['
|
||||
.. k
|
||||
.. '] = {win = {id = '
|
||||
.. v.win.id
|
||||
.. '}, topline = '
|
||||
.. '] = {win = '
|
||||
.. v.win
|
||||
.. ', topline = '
|
||||
.. v.topline
|
||||
.. ', botline = '
|
||||
.. v.botline
|
||||
@ -1505,7 +1505,7 @@ local function fmt_ext_state(name, state)
|
||||
elseif name == 'float_pos' then
|
||||
local str = '{\n'
|
||||
for k, v in pairs(state) do
|
||||
str = str .. ' [' .. k .. '] = {{id = ' .. v[1].id .. '}'
|
||||
str = str .. ' [' .. k .. '] = {' .. v[1]
|
||||
for i = 2, #v do
|
||||
str = str .. ', ' .. inspect(v[i])
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ describe('search highlighting', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 3,
|
||||
curline = 0,
|
||||
@ -617,7 +617,7 @@ describe('search highlighting', function()
|
||||
]],
|
||||
win_viewport = {
|
||||
[2] = {
|
||||
win = { id = 1000 },
|
||||
win = 1000,
|
||||
topline = 0,
|
||||
botline = 3,
|
||||
curline = 0,
|
||||
|
@ -138,7 +138,7 @@ for _, model in ipairs(mousemodels) do
|
||||
command('tabnew | tabprevious')
|
||||
api.nvim_set_option_value('statusline', '%2TNot clicky stuff%T', {})
|
||||
api.nvim_input_mouse('left', 'press', '', 0, 6, 0)
|
||||
eq(1, api.nvim_get_current_tabpage().id)
|
||||
eq(1, api.nvim_get_current_tabpage())
|
||||
api.nvim_set_option_value('statusline', '%2XNot clicky stuff%X', {})
|
||||
api.nvim_input_mouse('left', 'press', '', 0, 6, 0)
|
||||
eq(2, #api.nvim_list_tabpages())
|
||||
|
@ -25,8 +25,8 @@ describe('ui/ext_tabline', function()
|
||||
command('tabedit another-tab')
|
||||
|
||||
local expected_tabs = {
|
||||
{ tab = { id = 1 }, name = '[No Name]' },
|
||||
{ tab = { id = 2 }, name = 'another-tab' },
|
||||
{ tab = 1, name = '[No Name]' },
|
||||
{ tab = 2, name = 'another-tab' },
|
||||
}
|
||||
screen:expect {
|
||||
grid = [[
|
||||
@ -35,7 +35,7 @@ describe('ui/ext_tabline', function()
|
||||
|
|
||||
]],
|
||||
condition = function()
|
||||
eq({ id = 2 }, event_curtab)
|
||||
eq(2, event_curtab)
|
||||
eq(expected_tabs, event_tabs)
|
||||
end,
|
||||
}
|
||||
@ -48,7 +48,7 @@ describe('ui/ext_tabline', function()
|
||||
|
|
||||
]],
|
||||
condition = function()
|
||||
eq({ id = 1 }, event_curtab)
|
||||
eq(1, event_curtab)
|
||||
eq(expected_tabs, event_tabs)
|
||||
end,
|
||||
}
|
||||
@ -56,7 +56,7 @@ describe('ui/ext_tabline', function()
|
||||
|
||||
it('buffer UI events', function()
|
||||
local expected_buffers_initial = {
|
||||
{ buffer = { id = 1 }, name = '[No Name]' },
|
||||
{ buffer = 1, name = '[No Name]' },
|
||||
}
|
||||
|
||||
screen:expect {
|
||||
@ -66,7 +66,7 @@ describe('ui/ext_tabline', function()
|
||||
|
|
||||
]],
|
||||
condition = function()
|
||||
eq({ id = 1 }, event_curbuf)
|
||||
eq(1, event_curbuf)
|
||||
eq(expected_buffers_initial, event_buffers)
|
||||
end,
|
||||
}
|
||||
@ -75,8 +75,8 @@ describe('ui/ext_tabline', function()
|
||||
command('bnext')
|
||||
|
||||
local expected_buffers = {
|
||||
{ buffer = { id = 1 }, name = '[No Name]' },
|
||||
{ buffer = { id = 2 }, name = 'another-buffer' },
|
||||
{ buffer = 1, name = '[No Name]' },
|
||||
{ buffer = 2, name = 'another-buffer' },
|
||||
}
|
||||
screen:expect {
|
||||
grid = [[
|
||||
@ -85,7 +85,7 @@ describe('ui/ext_tabline', function()
|
||||
|
|
||||
]],
|
||||
condition = function()
|
||||
eq({ id = 2 }, event_curbuf)
|
||||
eq(2, event_curbuf)
|
||||
eq(expected_buffers, event_buffers)
|
||||
end,
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ describe('title', function()
|
||||
end)
|
||||
|
||||
it('setting the buffer of another window using RPC', function()
|
||||
local oldwin = curwin().id
|
||||
local oldwin = curwin()
|
||||
command('split')
|
||||
api.nvim_win_set_buf(oldwin, buf2)
|
||||
command('redraw!')
|
||||
@ -106,7 +106,7 @@ describe('title', function()
|
||||
end)
|
||||
|
||||
it('setting the buffer of another window using Lua callback', function()
|
||||
local oldwin = curwin().id
|
||||
local oldwin = curwin()
|
||||
command('split')
|
||||
exec_lua(string.format(
|
||||
[[
|
||||
|
@ -51,7 +51,7 @@ describe('winbar', function()
|
||||
]])
|
||||
-- winbar is excluded from the heights returned by winheight() and getwininfo()
|
||||
eq(11, fn.winheight(0))
|
||||
local win_info = fn.getwininfo(api.nvim_get_current_win().id)[1]
|
||||
local win_info = fn.getwininfo(api.nvim_get_current_win())[1]
|
||||
eq(11, win_info.height)
|
||||
eq(1, win_info.winbar)
|
||||
end)
|
||||
@ -428,7 +428,7 @@ describe('winbar', function()
|
||||
|
|
||||
]],
|
||||
}
|
||||
api.nvim_set_option_value('winbar', 'floaty bar', { scope = 'local', win = win.id })
|
||||
api.nvim_set_option_value('winbar', 'floaty bar', { scope = 'local', win = win })
|
||||
screen:expect {
|
||||
grid = [[
|
||||
{1:bar }|
|
||||
|
@ -243,7 +243,7 @@ describe('getbufvar() function', function()
|
||||
-- But with window-local options it probably does not what you expect
|
||||
command('setl number')
|
||||
-- (note that current window’s buffer is 2, but getbufvar() receives 1)
|
||||
eq({ id = 2 }, api.nvim_win_get_buf(0))
|
||||
eq(2, api.nvim_win_get_buf(0))
|
||||
eq(1, fn.getbufvar(1, '&number'))
|
||||
eq(1, fn.getbufvar(1, '&l:number'))
|
||||
-- You can get global value though, if you find this useful.
|
||||
@ -287,18 +287,18 @@ describe('setbufvar() function', function()
|
||||
eq(2, api.nvim_buf_get_number(api.nvim_win_get_buf(0)))
|
||||
fn.setbufvar(1, '&number', true)
|
||||
local windows = api.nvim_tabpage_list_wins(0)
|
||||
eq(false, api.nvim_get_option_value('number', { win = windows[1].id }))
|
||||
eq(true, api.nvim_get_option_value('number', { win = windows[2].id }))
|
||||
eq(false, api.nvim_get_option_value('number', { win = windows[3].id }))
|
||||
eq(false, api.nvim_get_option_value('number', { win = api.nvim_get_current_win().id }))
|
||||
eq(false, api.nvim_get_option_value('number', { win = windows[1] }))
|
||||
eq(true, api.nvim_get_option_value('number', { win = windows[2] }))
|
||||
eq(false, api.nvim_get_option_value('number', { win = windows[3] }))
|
||||
eq(false, api.nvim_get_option_value('number', { win = api.nvim_get_current_win() }))
|
||||
|
||||
eq(true, api.nvim_get_option_value('hidden', {}))
|
||||
fn.setbufvar(1, '&hidden', 0)
|
||||
eq(false, api.nvim_get_option_value('hidden', {}))
|
||||
|
||||
eq(false, api.nvim_get_option_value('autoindent', { buf = buf1.id }))
|
||||
eq(false, api.nvim_get_option_value('autoindent', { buf = buf1 }))
|
||||
fn.setbufvar(1, '&autoindent', true)
|
||||
eq(true, api.nvim_get_option_value('autoindent', { buf = buf1.id }))
|
||||
eq(true, api.nvim_get_option_value('autoindent', { buf = buf1 }))
|
||||
eq('Vim(call):E355: Unknown option: xxx', exc_exec('call setbufvar(1, "&xxx", 0)'))
|
||||
end)
|
||||
it('may set variables', function()
|
||||
|
Loading…
Reference in New Issue
Block a user