fix(tests): needing two calls to setup a screen is cringe

Before calling "attach" a screen object is just a dummy container for
(row, col) values whose purpose is to be sent as part of the "attach"
function call anyway.

Just create the screen in an attached state directly. Keep the complete
(row, col, options) config together. It is still completely valid to
later detach and re-attach as needed, including to another session.
This commit is contained in:
bfredl 2024-11-11 22:15:19 +01:00
parent 40dee8a2dc
commit e61228a214
161 changed files with 128 additions and 606 deletions

View File

@ -125,7 +125,6 @@ describe('api/buf', function()
it('cursor position is maintained consistently with viewport', function()
local screen = Screen.new(20, 12)
screen:attach()
local lines = { 'line1', 'line2', 'line3', 'line4', 'line5', 'line6' }
local buf = api.nvim_get_current_buf()
@ -211,7 +210,6 @@ describe('api/buf', function()
local screen
before_each(function()
screen = Screen.new(20, 12)
screen:attach()
api.nvim_buf_set_lines(
0,
0,
@ -735,7 +733,6 @@ describe('api/buf', function()
it("set_lines of invisible buffer doesn't move cursor in current window", function()
local screen = Screen.new(20, 5)
screen:attach()
insert([[
Who would win?
@ -1689,7 +1686,6 @@ describe('api/buf', function()
it('correctly marks changed region for redraw #13890', function()
local screen = Screen.new(20, 5)
screen:attach()
insert([[
AAA
@ -1742,7 +1738,6 @@ describe('api/buf', function()
local screen
before_each(function()
screen = Screen.new(20, 12)
screen:attach()
api.nvim_buf_set_lines(
0,
0,

View File

@ -455,7 +455,6 @@ describe('API/extmarks', function()
it('join works when no marks are present', function()
screen = Screen.new(15, 10)
screen:attach()
feed('a<cr>1<esc>')
feed('kJ')
-- This shouldn't seg fault
@ -508,7 +507,6 @@ describe('API/extmarks', function()
it('marks move with char inserts', function()
-- insertchar in edit.c (the ins_str branch)
screen = Screen.new(15, 10)
screen:attach()
set_extmark(ns, marks[1], 0, 3)
feed('0')
insert('abc')
@ -1726,7 +1724,6 @@ describe('API/extmarks', function()
it('invalidated marks are deleted', function()
screen = Screen.new(40, 6)
screen:attach()
feed('dd6iaaa bbb ccc<CR><ESC>gg')
api.nvim_set_option_value('signcolumn', 'auto:2', {})
set_extmark(ns, 1, 0, 0, { invalidate = true, sign_text = 'S1', end_row = 1 })
@ -1811,7 +1808,6 @@ describe('API/extmarks', function()
it('respects priority', function()
screen = Screen.new(15, 10)
screen:attach()
set_extmark(ns, marks[1], 0, 0, {
hl_group = 'Comment',
@ -1983,7 +1979,6 @@ describe('API/win_extmark', function()
it('sends and only sends ui-watched marks to ui', function()
screen = Screen.new(20, 4)
screen:attach()
-- should send this
set_extmark(ns, marks[1], 1, 0, { ui_watched = true })
-- should not send this
@ -2006,7 +2001,6 @@ describe('API/win_extmark', function()
it('sends multiple ui-watched marks to ui', function()
screen = Screen.new(20, 4)
screen:attach()
feed('15A!<Esc>')
-- should send all of these
set_extmark(ns, marks[1], 1, 0, { ui_watched = true, virt_text_pos = 'overlay' })
@ -2052,7 +2046,6 @@ describe('API/win_extmark', function()
it('updates ui-watched marks', function()
screen = Screen.new(20, 4)
screen:attach()
-- should send this
set_extmark(ns, marks[1], 1, 0, { ui_watched = true })
-- should not send this
@ -2096,8 +2089,7 @@ describe('API/win_extmark', function()
end)
it('sends ui-watched to splits', function()
screen = Screen.new(20, 8)
screen:attach({ ext_multigrid = true })
screen = Screen.new(20, 8, { ext_multigrid = true })
-- should send this
set_extmark(ns, marks[1], 1, 0, { ui_watched = true })
-- should not send this

View File

@ -11,7 +11,6 @@ describe('update_menu notification', function()
before_each(function()
clear()
screen = Screen.new()
screen:attach()
end)
local function expect_sent(expected)

View File

@ -18,8 +18,7 @@ describe('nvim_ui_attach()', function()
end)
it('handles very large width/height #2180', function()
local screen = Screen.new(999, 999)
screen:attach()
local _ = Screen.new(999, 999)
eq(999, eval('&lines'))
eq(999, eval('&columns'))
end)
@ -64,8 +63,7 @@ describe('nvim_ui_attach()', function()
eq('UI not attached to channel: 1', pcall_err(request, 'nvim_ui_set_option', 'rgb', true))
eq('UI not attached to channel: 1', pcall_err(request, 'nvim_ui_detach'))
local screen = Screen.new()
screen:attach({ rgb = false })
local _ = Screen.new(nil, nil, { rgb = false })
eq(
'UI already attached to channel: 1',
pcall_err(request, 'nvim_ui_attach', 40, 10, { rgb = false })
@ -82,7 +80,6 @@ it('autocmds UIEnter/UILeave', function()
autocmd VimEnter * call add(g:evs, "VimEnter")
]])
local screen = Screen.new()
screen:attach()
eq({ chan = 1 }, eval('g:uienter_ev'))
screen:detach()
eq({ chan = 1 }, eval('g:uileave_ev'))
@ -96,7 +93,6 @@ end)
it('autocmds VimSuspend/VimResume #22041', function()
clear()
local screen = Screen.new()
screen:attach()
exec([[
let g:ev = []
autocmd VimResume * :call add(g:ev, 'r')

View File

@ -366,7 +366,6 @@ describe('API', function()
it('displays messages when opts.output=false', function()
local screen = Screen.new(40, 8)
screen:attach()
api.nvim_exec2("echo 'hello'", { output = false })
screen:expect {
grid = [[
@ -379,7 +378,6 @@ describe('API', function()
it("doesn't display messages when output=true", function()
local screen = Screen.new(40, 6)
screen:attach()
api.nvim_exec2("echo 'hello'", { output = true })
screen:expect {
grid = [[
@ -1278,7 +1276,6 @@ describe('API', function()
end)
it('pasting with empty last chunk in Cmdline mode', function()
local screen = Screen.new(20, 4)
screen:attach()
feed(':')
api.nvim_paste('Foo', true, 1)
api.nvim_paste('', true, 3)
@ -1290,7 +1287,6 @@ describe('API', function()
end)
it('pasting text with control characters in Cmdline mode', function()
local screen = Screen.new(20, 4)
screen:attach()
feed(':')
api.nvim_paste('normal! \023\022\006\027', true, -1)
screen:expect([[
@ -1675,7 +1671,6 @@ describe('API', function()
eq({ 1, 5 }, api.nvim_win_get_cursor(0))
local screen = Screen.new(60, 3)
screen:attach()
eq(1, eval('v:hlsearch'))
screen:expect {
grid = [[
@ -2130,7 +2125,6 @@ describe('API', function()
it('does not complete ("interrupt") `d` #3732', function()
local screen = Screen.new(20, 4)
screen:attach()
command('set listchars=eol:$')
command('set list')
feed('ia<cr>b<cr>c<cr><Esc>kkk')
@ -2391,7 +2385,6 @@ describe('API', function()
before_each(function()
screen = Screen.new(40, 8)
screen:attach()
end)
it('prints long messages correctly #20534', function()
@ -2461,7 +2454,6 @@ describe('API', function()
before_each(function()
screen = Screen.new(40, 8)
screen:attach()
end)
it('can show one line', function()
@ -2543,7 +2535,6 @@ describe('API', function()
before_each(function()
screen = Screen.new(40, 8)
screen:attach()
end)
it('shows only one return prompt after all lines are shown', function()
@ -3100,8 +3091,7 @@ describe('API', function()
eq({}, api.nvim_list_uis())
end)
it('returns attached UIs', function()
local screen = Screen.new(20, 4)
screen:attach({ override = true })
local screen = Screen.new(20, 4, { override = true })
local expected = {
{
chan = 1,
@ -3129,8 +3119,7 @@ describe('API', function()
eq(expected, api.nvim_list_uis())
screen:detach()
screen = Screen.new(44, 99)
screen:attach({ rgb = false })
screen = Screen.new(44, 99, { rgb = false }) -- luacheck: ignore
expected[1].rgb = false
expected[1].override = false
expected[1].width = 44
@ -3165,7 +3154,6 @@ describe('API', function()
eq(1, api.nvim_get_current_buf())
local screen = Screen.new(20, 4)
screen:attach()
api.nvim_buf_set_lines(2, 0, -1, true, { 'some text' })
api.nvim_set_current_buf(2)
screen:expect(
@ -3229,7 +3217,6 @@ describe('API', function()
eq(1, api.nvim_get_current_buf())
local screen = Screen.new(20, 4)
screen:attach()
--
-- Editing a scratch-buffer does NOT change its properties.
@ -3591,7 +3578,6 @@ describe('API', function()
before_each(function()
screen = Screen.new(40, 8)
screen:attach()
command('highlight Statement gui=bold guifg=Brown')
command('highlight Special guifg=SlateBlue')
end)
@ -3654,7 +3640,6 @@ describe('API', function()
before_each(function()
screen = Screen.new(100, 35)
screen:attach()
screen:add_extra_attr_ids {
[100] = { background = tonumber('0xffff40'), bg_indexed = true },
[101] = {
@ -3933,7 +3918,6 @@ describe('API', function()
command('set readonly')
eq({ str = '[RO]', width = 4 }, api.nvim_eval_statusline('%r', { maxwidth = 5 }))
local screen = Screen.new(80, 24)
screen:attach()
command('set showcmd')
feed('1234')
screen:expect({ any = '1234' })
@ -4591,7 +4575,6 @@ describe('API', function()
end)
it('does not interfere with printing line in Ex mode #19400', function()
local screen = Screen.new(60, 7)
screen:attach()
insert([[
foo
bar]])
@ -5048,7 +5031,6 @@ describe('API', function()
it("doesn't display messages when output=true", function()
local screen = Screen.new(40, 6)
screen:attach()
api.nvim_cmd({ cmd = 'echo', args = { [['hello']] } }, { output = true })
screen:expect {
grid = [[
@ -5131,7 +5113,6 @@ describe('API', function()
it('nvim__redraw', function()
local screen = Screen.new(60, 5)
screen:attach()
eq('at least one action required', pcall_err(api.nvim__redraw, {}))
eq('at least one action required', pcall_err(api.nvim__redraw, { buf = 0 }))
eq('at least one action required', pcall_err(api.nvim__redraw, { win = 0 }))

View File

@ -170,7 +170,6 @@ describe('API/win', function()
it('updates the screen, and also when the window is unfocused', function()
local screen = Screen.new(30, 9)
screen:attach()
insert('prologue')
feed('100o<esc>')
@ -281,7 +280,6 @@ describe('API/win', function()
it('updates cursorline and statusline ruler in non-current window', function()
local screen = Screen.new(60, 8)
screen:attach()
command('set ruler')
command('set cursorline')
insert([[
@ -314,7 +312,6 @@ describe('API/win', function()
it('updates cursorcolumn in non-current window', function()
local screen = Screen.new(60, 8)
screen:attach()
command('set cursorcolumn')
insert([[
aaa
@ -857,7 +854,6 @@ describe('API/win', function()
it('with two diff windows', function()
local X = api.nvim_get_vvar('maxcol')
local screen = Screen.new(45, 22)
screen:attach()
exec([[
set diffopt+=context:2 number
let expr = 'printf("%08d", v:val) .. repeat("!", v:val)'
@ -975,7 +971,6 @@ describe('API/win', function()
it('with wrapped lines', function()
local X = api.nvim_get_vvar('maxcol')
local screen = Screen.new(45, 22)
screen:attach()
exec([[
set number cpoptions+=n
call setline(1, repeat([repeat('foobar-', 36)], 3))
@ -2557,7 +2552,6 @@ describe('API/win', function()
it('updates statusline when moving bottom split', function()
local screen = Screen.new(10, 10)
screen:attach()
exec([[
set laststatus=0
belowright split

View File

@ -102,7 +102,6 @@ describe('oldtests', function()
-- oldtest: Test_delete_ml_get_errors()
it('no ml_get error with TextChanged autocommand and delete', function()
local screen = Screen.new(75, 10)
screen:attach()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Cyan1 },
}

View File

@ -258,7 +258,6 @@ describe('autocmd', function()
-- Check redrawing and API accesses to this window.
local screen = Screen.new(50, 10)
screen:attach()
source([[
function! Doit()
@ -333,7 +332,6 @@ describe('autocmd', function()
it('`aucmd_win` cannot be changed into a normal window #13699', function()
local screen = Screen.new(50, 10)
screen:attach()
-- Create specific layout and ensure it's left unchanged.
-- Use vim._with on a hidden buffer so aucmd_win is used.
@ -498,7 +496,6 @@ describe('autocmd', function()
it(':doautocmd does not warn "No matching autocommands" #10689', function()
local screen = Screen.new(32, 3)
screen:attach()
feed(':doautocmd User Foo<cr>')
screen:expect {

View File

@ -60,7 +60,6 @@ describe('cmdline autocommands', function()
it('handles errors correctly', function()
clear()
local screen = Screen.new(72, 8)
screen:attach()
command("autocmd CmdlineEnter * echoerr 'FAIL'")
command("autocmd CmdlineLeave * echoerr 'very error'")

View File

@ -46,7 +46,6 @@ describe(':autocmd', function()
screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.Magenta, bold = true },
}
screen:attach()
exec([[
set more
autocmd! BufEnter

View File

@ -225,8 +225,7 @@ end)
describe('WinScrolled', function()
-- oldtest: Test_WinScrolled_mouse()
it('is triggered by mouse scrolling in another window', function()
local screen = Screen.new(75, 10)
screen:attach()
local _ = Screen.new(75, 10)
exec([[
set nowrap scrolloff=0
set mouse=a
@ -304,7 +303,6 @@ describe('WinScrolled', function()
it('is triggered by mouse scrolling in unfocused floating window #18222', function()
local screen = Screen.new(80, 24)
screen:attach()
exec([[
let g:scrolled = 0

View File

@ -59,7 +59,6 @@ describe('fileio', function()
local screen_nvim = spawn(argv)
set_session(screen_nvim)
local screen = Screen.new(70, 10)
screen:attach()
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.NvimDarkGrey4 },
[2] = { background = Screen.colors.NvimDarkGrey1, foreground = Screen.colors.NvimLightGrey3 },
@ -276,7 +275,6 @@ describe('fileio', function()
write_file('Xtest-overwrite-forced', 'foobar')
command('set nofixendofline')
local screen = Screen.new(40, 4)
screen:attach()
command('set shortmess-=F')
command('e Xtest-overwrite-forced')

View File

@ -498,7 +498,6 @@ describe('jobs', function()
it('can redefine callbacks being used by a job', function()
local screen = Screen.new()
screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue },
})
@ -524,7 +523,6 @@ describe('jobs', function()
it('requires funcrefs for script-local (s:) functions', function()
local screen = Screen.new(60, 5)
screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
@ -910,7 +908,6 @@ describe('jobs', function()
it('hides cursor and flushes messages before blocking', function()
local screen = Screen.new(50, 6)
screen:attach()
command([[let g:id = jobstart([v:progpath, '--clean', '--headless'])]])
source([[
func PrintAndWait()
@ -1223,7 +1220,6 @@ describe('pty process teardown', function()
before_each(function()
clear()
screen = Screen.new(30, 6)
screen:attach()
screen:expect([[
^ |
{1:~ }|*4

View File

@ -89,7 +89,6 @@ describe('command-line option', function()
it('does not crash after reading from stdin in non-headless mode', function()
skip(is_os('win'))
local screen = Screen.new(40, 8)
screen:attach()
local args = {
nvim_prog_abs(),
'-u',

View File

@ -55,7 +55,6 @@ describe('startup', function()
clear()
local screen
screen = Screen.new(84, 3)
screen:attach()
fn.termopen({ nvim_prog, '-u', 'NONE', '--server', eval('v:servername'), '--remote-ui' })
screen:expect([[
^Cannot attach UI of :terminal child to its parent. (Unset $NVIM to skip this check) |
@ -97,7 +96,6 @@ describe('startup', function()
clear()
local screen
screen = Screen.new(60, 7)
screen:attach()
-- not the same colors on windows for some reason
screen._default_attr_ids = nil
local id = fn.termopen({
@ -346,7 +344,6 @@ describe('startup', function()
it('with --embed: has("ttyin")==0 has("ttyout")==0', function()
local screen = Screen.new(25, 3)
-- Remote UI connected by --embed.
screen:attach()
-- TODO: a lot of tests in this file already use the new default color scheme.
-- once we do the batch update of tests to use it, remove this workarond
screen._default_attr_ids = nil
@ -360,7 +357,6 @@ describe('startup', function()
it('in a TTY: has("ttyin")==1 has("ttyout")==1', function()
local screen = Screen.new(25, 4)
screen:attach()
screen._default_attr_ids = nil
if is_os('win') then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
@ -455,7 +451,6 @@ describe('startup', function()
it('input from pipe (implicit) #7679', function()
clear({ env = { NVIM_LOG_FILE = testlog } })
local screen = Screen.new(25, 4)
screen:attach()
screen._default_attr_ids = nil
if is_os('win') then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
@ -620,7 +615,6 @@ describe('startup', function()
it('ENTER dismisses early message #7967', function()
local screen
screen = Screen.new(60, 6)
screen:attach()
screen._default_attr_ids = nil
local id = fn.termopen({
nvim_prog,
@ -718,7 +712,6 @@ describe('startup', function()
it('-e/-E interactive #7679', function()
clear('-e')
local screen = Screen.new(25, 3)
screen:attach()
feed("put ='from -e'<CR>")
screen:expect([[
:put ='from -e' |
@ -728,7 +721,6 @@ describe('startup', function()
clear('-E')
screen = Screen.new(25, 3)
screen:attach()
feed("put ='from -E'<CR>")
screen:expect([[
:put ='from -E' |
@ -738,9 +730,8 @@ describe('startup', function()
end)
it('-e sets ex mode', function()
local screen = Screen.new(25, 3)
clear('-e')
screen:attach()
local screen = Screen.new(25, 3)
-- Verify we set the proper mode both before and after :vi.
feed('put =mode(1)<CR>vi<CR>:put =mode(1)<CR>')
screen:expect([[
@ -792,7 +783,6 @@ describe('startup', function()
it("sets 'shortmess' when loading other tabs", function()
clear({ args = { '-p', 'a', 'b', 'c' } })
local screen = Screen.new(25, 4)
screen:attach()
screen:expect({
grid = [[
{1: a }{2: b c }{3: }{2:X}|
@ -1155,7 +1145,6 @@ describe('user config init', function()
eq('---', eval('g:exrc_file'))
local screen = Screen.new(50, 8)
screen:attach()
screen._default_attr_ids = nil
fn.termopen({ nvim_prog }, {
env = {
@ -1431,7 +1420,6 @@ describe('inccommand on ex mode', function()
clear()
local screen
screen = Screen.new(60, 10)
screen:attach()
local id = fn.termopen({
nvim_prog,
'-u',

View File

@ -17,7 +17,6 @@ describe('completion', function()
before_each(function()
clear()
screen = Screen.new(60, 8)
screen:attach()
screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.Gray0, background = Screen.colors.Yellow },
[101] = { background = Screen.colors.Gray0 },

View File

@ -13,7 +13,6 @@ describe('CTRL-C (mapped)', function()
before_each(function()
clear()
screen = Screen.new(52, 6)
screen:attach()
end)
it('interrupts :global', function()

View File

@ -35,7 +35,6 @@ describe('default', function()
args = { '+autocmd! nvim_popupmenu', '+aunmenu PopUp' },
}
local screen = Screen.new(40, 8)
screen:attach()
n.insert([[
1 line 1
2 https://example.com
@ -58,7 +57,6 @@ describe('default', function()
it('right-click on URL shows "Open in web browser"', function()
n.clear()
local screen = Screen.new(40, 8)
screen:attach()
n.insert([[
1 line 1
2 https://example.com
@ -100,7 +98,6 @@ describe('default', function()
it('do not show a full stack trace #30625', function()
n.clear({ args_rm = { '--cmd' } })
local screen = Screen.new(40, 8)
screen:attach()
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.NvimDarkGray4 },
[2] = {

View File

@ -56,7 +56,6 @@ describe('jumplist', function()
write_file(fname2, 'baz')
local screen = Screen.new(5, 25)
screen:attach()
command('set number')
command('edit ' .. fname1)
feed('35gg')
@ -386,7 +385,6 @@ describe('jumpoptions=view', function()
it('restores the view', function()
local screen = Screen.new(5, 8)
screen:attach()
command('edit ' .. file1)
feed('12Gztj')
feed('gg<C-o>')
@ -404,7 +402,6 @@ describe('jumpoptions=view', function()
it('restores the view across files', function()
local screen = Screen.new(5, 5)
screen:attach()
command('args ' .. file1 .. ' ' .. file2)
feed('12Gzt')
command('next')
@ -428,7 +425,6 @@ describe('jumpoptions=view', function()
it('restores the view across files with <C-^>', function()
local screen = Screen.new(5, 5)
screen:attach()
command('args ' .. file1 .. ' ' .. file2)
feed('12Gzt')
command('next')
@ -452,7 +448,6 @@ describe('jumpoptions=view', function()
it("falls back to standard behavior when view can't be recovered", function()
local screen = Screen.new(5, 8)
screen:attach()
command('edit ' .. file1)
feed('7GzbG')
api.nvim_buf_set_lines(0, 0, 2, true, {})
@ -477,7 +472,6 @@ describe('jumpoptions=view', function()
it('falls back to standard behavior for a mark without a view', function()
local screen = Screen.new(5, 8)
screen:attach()
command('edit ' .. file1)
feed('10ggzzvwy')
screen:expect([[

View File

@ -348,7 +348,6 @@ describe('named marks view', function()
it('is restored in normal mode but not op-pending mode', function()
local screen = Screen.new(5, 8)
screen:attach()
command('edit ' .. file1)
feed('<C-e>jWma')
feed("G'a")
@ -390,7 +389,6 @@ describe('named marks view', function()
it('is restored across files', function()
local screen = Screen.new(5, 5)
screen:attach()
command('args ' .. file1 .. ' ' .. file2)
feed('<C-e>mA')
local mark_view = [[
@ -415,7 +413,6 @@ describe('named marks view', function()
it("fallback to standard behavior when view can't be recovered", function()
local screen = Screen.new(10, 10)
screen:attach()
command('edit ' .. file1)
feed('7GzbmaG') -- Seven lines from the top
command('new') -- Screen size for window is now half the height can't be restored
@ -434,7 +431,6 @@ describe('named marks view', function()
it('fallback to standard behavior when mark is loaded from shada', function()
local screen = Screen.new(10, 6)
screen:attach()
command('edit ' .. file1)
feed('G')
feed('mA')

View File

@ -44,7 +44,6 @@ describe('cmdline', function()
-- 'arabicshape' cheats and always redraws everything which trivially works,
-- this test is for partial redraws in 'noarabicshape' mode.
command('set noarabicshape')
screen:attach()
fn.setreg('a', '💻')
feed(':test 🧑‍')
screen:expect([[
@ -69,7 +68,6 @@ describe('cmdline', function()
it('redraws statusline when toggling overstrike', function()
local screen = Screen.new(60, 4)
screen:attach()
command('set laststatus=2 statusline=%!mode(1)')
feed(':')
screen:expect {

View File

@ -55,7 +55,6 @@ describe('insert-mode', function()
it('double quote is removed after hit-enter prompt #22609', function()
local screen = Screen.new(50, 6)
screen:attach()
feed('i<C-R>')
screen:expect([[
{18:^"} |
@ -180,7 +179,6 @@ describe('insert-mode', function()
it('multi-char mapping updates screen properly #25626', function()
local screen = Screen.new(60, 6)
screen:attach()
command('vnew')
insert('foo\nfoo\nfoo')
command('wincmd w')
@ -228,8 +226,7 @@ describe('insert-mode', function()
end
it('works with tabs and spaces', function()
local screen = Screen.new(30, 2)
screen:attach()
local _ = Screen.new(30, 2)
command('setl ts=4 sw=4')
set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a')
feed('$i')
@ -246,8 +243,7 @@ describe('insert-mode', function()
end)
it('works with varsofttabstop', function()
local screen = Screen.new(30, 2)
screen:attach()
local _ = Screen.new(30, 2)
command('setl vsts=6,2,5,3')
set_lines(0, 1, 'a\t' .. s(4) .. '\t a')
feed('$i')
@ -263,8 +259,7 @@ describe('insert-mode', function()
end)
it('works with tab as ^I', function()
local screen = Screen.new(30, 2)
screen:attach()
local _ = Screen.new(30, 2)
command('set list listchars=space:.')
command('setl ts=4 sw=4')
set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a')
@ -280,8 +275,7 @@ describe('insert-mode', function()
end)
it('works in replace mode', function()
local screen = Screen.new(50, 2)
screen:attach()
local _ = Screen.new(50, 2)
command('setl ts=8 sw=8 sts=8')
set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a')
feed('$R')
@ -296,8 +290,7 @@ describe('insert-mode', function()
end)
it('works with breakindent', function()
local screen = Screen.new(17, 4)
screen:attach()
local _ = Screen.new(17, 4)
command('setl ts=4 sw=4 bri briopt=min:5')
set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a')
feed('$i')
@ -314,8 +307,7 @@ describe('insert-mode', function()
end)
it('works with inline virtual text', function()
local screen = Screen.new(50, 2)
screen:attach()
local _ = Screen.new(50, 2)
command('setl ts=4 sw=4')
set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a')
local ns = api.nvim_create_namespace('')
@ -335,8 +327,7 @@ describe('insert-mode', function()
end)
it("works with 'revins'", function()
local screen = Screen.new(30, 3)
screen:attach()
local _ = Screen.new(30, 3)
command('setl ts=4 sw=4 revins')
set_lines(0, 1, ('a'):rep(16), s(3) .. '\t' .. s(4) .. '\t a')
feed('j$i')
@ -354,7 +345,6 @@ describe('insert-mode', function()
it('backspace after replacing multibyte chars', function()
local screen = Screen.new(30, 3)
screen:attach()
api.nvim_buf_set_lines(0, 0, -1, true, { 'test ȧ̟̜̝̅̚m̆̉̐̐̇̈ å' })
feed('^Rabcdefghi')
screen:expect([[

View File

@ -26,7 +26,6 @@ describe('Normal mode', function()
it('&showcmd does not crash with :startinsert #28419', function()
local screen = Screen.new(60, 17)
screen:attach()
fn.termopen(
{ n.nvim_prog, '--clean', '--cmd', 'startinsert' },
{ env = { VIMRUNTIME = os.getenv('VIMRUNTIME') } }
@ -45,7 +44,6 @@ describe('Normal mode', function()
it('replacing with ZWJ emoji sequences', function()
local screen = Screen.new(30, 8)
screen:attach()
api.nvim_buf_set_lines(0, 0, -1, true, { 'abcdefg' })
feed('05r🧑🌾') -- ZWJ
screen:expect([[

View File

@ -883,7 +883,6 @@ describe('put command', function()
local screen
setup(function()
screen = Screen.new()
screen:attach()
end)
local function bell_test(actions, should_ring)

View File

@ -105,7 +105,6 @@ describe('tabpage', function()
screen:add_extra_attr_ids {
[100] = { bold = true, foreground = Screen.colors.Fuchsia },
}
screen:attach()
command('tabnew')
command('tabprev')

View File

@ -65,7 +65,6 @@ describe('the first line is redrawn correctly after inserting text in an empty b
[1] = { bold = true, foreground = Screen.colors.Blue },
[2] = { bold = true, reverse = true },
})
screen:attach()
end)
it('using :append', function()

View File

@ -37,7 +37,6 @@ describe('mappings with <Cmd>', function()
[9] = { background = Screen.colors.LightMagenta },
[10] = { foreground = Screen.colors.Red },
})
screen:attach()
cmdmap('<F3>', 'let m = mode(1)')
cmdmap('<F4>', 'normal! ww')

View File

@ -15,7 +15,6 @@ describe(':debug', function()
[3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
[4] = { bold = true, foreground = Screen.colors.SeaGreen4 },
})
screen:attach()
end)
it('scrolls messages correctly', function()
feed(':echoerr bork<cr>')

View File

@ -19,7 +19,6 @@ describe(':digraphs', function()
[6] = { foreground = Screen.colors.Blue1 },
[7] = { bold = true, reverse = true },
})
screen:attach()
end)
it('displays digraphs', function()

View File

@ -11,7 +11,6 @@ describe(':drop', function()
before_each(function()
clear()
screen = Screen.new(35, 10)
screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { bold = true, reverse = true },

View File

@ -10,12 +10,9 @@ local fn = n.fn
local api = n.api
describe(':highlight', function()
local screen
before_each(function()
clear()
screen = Screen.new()
screen:attach()
local _ = Screen.new()
end)
it('invalid color name', function()

View File

@ -103,7 +103,6 @@ describe('Screen', function()
before_each(function()
clear()
screen = Screen.new(20, 5)
screen:attach()
end)
it('cursor is restored after :map <expr> which calls input()', function()

View File

@ -201,8 +201,7 @@ describe(':mksession', function()
local cwd_dir = fn.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '')
local session_path = cwd_dir .. '/' .. session_file
screen = Screen.new(50, 6)
screen:attach({ rgb = false })
screen = Screen.new(50, 6, { rgb = false })
local expected_screen = [[
^/ |
|
@ -222,8 +221,7 @@ describe(':mksession', function()
-- Create a new test instance of Nvim.
clear()
screen = Screen.new(50, 6)
screen:attach({ rgb = false })
screen = Screen.new(50, 6, { rgb = false })
command('silent source ' .. session_path)
-- Verify that the terminal's working directory is "/".

View File

@ -38,7 +38,6 @@ describe(':oldfiles', function()
it('shows most recently used files', function()
local screen = Screen.new(100, 5)
screen:attach()
screen._default_attr_ids = nil
feed_command('edit testfile1')
feed_command('edit testfile2')

View File

@ -199,7 +199,6 @@ describe('quickfix', function()
it('jump message does not scroll with cmdheight=0 and shm+=O #29597', function()
local screen = Screen.new(40, 6)
screen:attach()
command('set cmdheight=0')
local file = file_base .. '_reuse_qfbuf_BufAdd'
write_file(file, 'foobar')
@ -226,7 +225,6 @@ it(':vimgrep can specify Unicode pattern without delimiters', function()
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { reverse = true }, -- IncSearch
})
screen:attach()
feed('i→<Esc>:vimgrep →')
screen:expect([[
{1:} |

View File

@ -114,7 +114,6 @@ describe("preserve and (R)ecover with custom 'directory'", function()
it('killing TUI process without :preserve #22096', function()
t.skip(t.is_os('win'))
local screen0 = Screen.new()
screen0:attach()
local child_server = new_pipename()
fn.termopen({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--listen', child_server }, {
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
@ -171,7 +170,6 @@ describe('swapfile detection', function()
local nvim2 = spawn({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed' }, true, nil, true)
set_session(nvim2)
local screen2 = Screen.new(256, 40)
screen2:attach()
screen2._default_attr_ids = nil
exec(init)
command('autocmd! nvim_swapfile') -- Delete the default handler (which skips the dialog).
@ -254,7 +252,6 @@ describe('swapfile detection', function()
local nvim1 = spawn(new_argv(), true, nil, true)
set_session(nvim1)
local screen = Screen.new(75, 18)
screen:attach()
exec(init)
feed(':edit Xfile1\n')
@ -325,7 +322,6 @@ describe('swapfile detection', function()
[1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
[2] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach()
exec(init)
if not swapexists then

View File

@ -14,7 +14,6 @@ describe('example', function()
before_each(function()
clear()
screen = Screen.new(20, 5)
screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { bold = true, foreground = Screen.colors.Brown },
@ -47,8 +46,7 @@ describe('example', function()
-- The UI must declare that it wants to handle the UI events.
-- For this example, we enable `ext_tabline`:
screen:detach()
screen = Screen.new(25, 5)
screen:attach({ rgb = true, ext_tabline = true })
screen = Screen.new(25, 5, { rgb = true, ext_tabline = true })
-- From ":help ui" we find that `tabline_update` receives `curtab` and
-- `tabs` objects. So we declare the UI handler like this:

View File

@ -11,7 +11,6 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
it('is working', function()
local screen = Screen.new(40, 5)
screen:attach()
command('highlight MyGroup1 term=bold ctermbg=red guibg=red')
command('highlight MyGroup2 term=italic ctermbg=green guibg=green')

View File

@ -13,7 +13,6 @@ describe('107', function()
it('is working', function()
local screen = Screen.new()
screen:attach()
insert('start:')
poke_eventloop()

View File

@ -20,7 +20,6 @@ describe('argument list commands', function()
it(':confirm quit with unedited files in arglist', function()
local screen = Screen.new(60, 6)
screen:attach()
command('set nomore')
command('args a b c')
feed(':confirm quit\n')

View File

@ -17,7 +17,6 @@ describe('breakindent', function()
[1] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, -- SignColumn
[2] = { bold = true }, -- ModeMsg
})
screen:attach()
exec([[
set listchars=eol:$
let &signcolumn = 'yes'
@ -68,7 +67,6 @@ describe('breakindent', function()
setlocal breakindent
call setline(1, "\t" .. join(range(100)))
]])
screen:attach()
feed('v$')
screen:expect([[

View File

@ -15,7 +15,6 @@ describe('cmdline', function()
-- oldtest: Test_cmdlineclear_tabenter()
it('is cleared when switching tabs', function()
local screen = Screen.new(30, 10)
screen:attach()
feed_command([[call setline(1, range(30))]])
screen:expect([[
@ -79,7 +78,6 @@ describe('cmdline', function()
-- oldtest: Test_verbose_option()
it('prints every executed Ex command if verbose >= 16', function()
local screen = Screen.new(60, 12)
screen:attach()
exec([[
command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v
call feedkeys("\r", 't') " for the hit-enter prompt
@ -104,7 +102,6 @@ describe('cmdline', function()
-- oldtest: Test_cmdline_redraw_tabline()
it('tabline is redrawn on entering cmdline', function()
local screen = Screen.new(30, 6)
screen:attach()
exec([[
set showtabline=2
autocmd CmdlineEnter * set tabline=foo
@ -121,7 +118,6 @@ describe('cmdline', function()
-- oldtest: Test_redraw_in_autocmd()
it('cmdline cursor position is correct after :redraw with cmdheight=2', function()
local screen = Screen.new(30, 6)
screen:attach()
exec([[
set cmdheight=2
autocmd CmdlineChanged * redraw
@ -145,7 +141,6 @@ describe('cmdline', function()
it("setting 'cmdheight' works after outputting two messages vim-patch:9.0.0665", function()
local screen = Screen.new(60, 8)
screen:attach()
exec([[
set cmdheight=1 laststatus=2
func EchoTwo()
@ -175,7 +170,6 @@ describe('cmdline', function()
-- oldtest: Test_cmdheight_tabline()
it("changing 'cmdheight' when there is a tabline", function()
local screen = Screen.new(60, 8)
screen:attach()
api.nvim_set_option_value('laststatus', 2, {})
api.nvim_set_option_value('showtabline', 2, {})
api.nvim_set_option_value('cmdheight', 1, {})
@ -191,7 +185,6 @@ describe('cmdline', function()
-- oldtest: Test_rulerformat_position()
it("ruler has correct position with 'rulerformat' set", function()
local screen = Screen.new(20, 3)
screen:attach()
api.nvim_set_option_value('ruler', true, {})
api.nvim_set_option_value('rulerformat', 'longish', {})
api.nvim_set_option_value('laststatus', 0, {})
@ -218,7 +211,6 @@ describe('cmdwin', function()
[3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
[4] = { bold = true }, -- ModeMsg
})
screen:attach()
command('set more')
command('autocmd WinNew * highlight')
feed('q:')

View File

@ -21,7 +21,6 @@ describe('Conceal', function()
-- oldtest: Test_conceal_two_windows()
it('works', function()
local screen = Screen.new(75, 12)
screen:attach()
exec([[
let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]
call setline(1, lines)
@ -385,7 +384,6 @@ describe('Conceal', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.LightRed },
}
screen:attach()
-- Check that cursorcolumn and colorcolumn don't get broken in presence of
-- wrapped lines containing concealed text
-- luacheck: push ignore 613 (trailing whitespace in a string)
@ -434,7 +432,6 @@ describe('Conceal', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.WebGreen },
}
screen:attach()
exec([[
call setline(1, 'one one one |hidden| one one one one one one one one')
syntax match test /|hidden|/ conceal
@ -463,7 +460,6 @@ describe('Conceal', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.WebGreen },
}
screen:attach()
exec([[
call setline(1, 'one one one |hidden| one one one one one one one one')
syntax match test /|hidden|/ conceal
@ -489,7 +485,6 @@ describe('Conceal', function()
-- oldtest: Test_conceal_resize_term()
it('resize editor', function()
local screen = Screen.new(75, 6)
screen:attach()
exec([[
call setline(1, '`one` `two` `three` `four` `five`, the backticks should be concealed')
setl cocu=n cole=3
@ -513,7 +508,6 @@ describe('Conceal', function()
-- oldtest: Test_conceal_linebreak()
it('with linebreak', function()
local screen = Screen.new(75, 8)
screen:attach()
exec([[
let &wrap = v:true
let &conceallevel = 2
@ -619,7 +613,6 @@ describe('Conceal', function()
local function test_conceal_virtualedit_after_eol(wrap)
local screen = Screen.new(60, 3)
screen:attach()
api.nvim_set_option_value('wrap', wrap, {})
exec([[
call setline(1, 'abcdefgh|hidden|ijklmnpop')
@ -670,7 +663,6 @@ describe('Conceal', function()
local function test_conceal_virtualedit_after_eol_rightleft(wrap)
local screen = Screen.new(60, 3)
screen:attach()
api.nvim_set_option_value('wrap', wrap, {})
exec([[
call setline(1, 'abcdefgh|hidden|ijklmnpop')
@ -724,7 +716,6 @@ describe('Conceal', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.LightRed },
}
screen:attach()
api.nvim_set_option_value('wrap', wrap, {})
exec([[
call setline(1, ['aaaaa口=口bbbbb口=口ccccc', 'foobar'])
@ -777,7 +768,6 @@ describe('Conceal', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.LightRed },
}
screen:attach()
exec([[
call setline(1, 'aaaaaaaaaa口=口bbbbbbbbbb口=口cccccccccc')
syntax match test /=/ conceal cchar=β

View File

@ -10,7 +10,6 @@ before_each(clear)
describe('cpoptions', function()
it('$', function()
local screen = Screen.new(30, 6)
screen:attach()
command('set cpo+=$')
command([[call setline(1, 'one two three')]])
feed('c2w')

View File

@ -14,7 +14,6 @@ describe('debugger', function()
before_each(function()
screen = Screen.new(999, 10)
screen:attach()
end)
-- oldtest: Test_Debugger_breakadd_expr()

View File

@ -10,7 +10,6 @@ describe('digraph', function()
-- oldtest: Test_entering_digraph()
it('characters displayed on the screen', function()
local screen = Screen.new(10, 6)
screen:attach()
feed('i<C-K>')
screen:expect([[
{18:^?} |

View File

@ -12,7 +12,6 @@ describe('display', function()
-- oldtest: Test_display_scroll_at_topline()
it('scroll when modified at topline vim-patch:8.2.1488', function()
local screen = Screen.new(20, 4)
screen:attach()
command([[call setline(1, repeat('a', 21))]])
feed('O')
@ -27,7 +26,6 @@ describe('display', function()
-- oldtest: Test_display_scroll_update_visual()
it('scrolling when modified at topline in Visual mode vim-patch:8.2.4626', function()
local screen = Screen.new(60, 8)
screen:attach()
exec([[
set scrolloff=0
@ -52,7 +50,6 @@ describe('display', function()
[2] = { bold = true, reverse = true }, -- StatusLine
[3] = { reverse = true }, -- StatusLineNC
})
screen:attach()
exec([[
call setline(1, ['aaa', 'b'->repeat(200)])
set display=truncate
@ -131,7 +128,6 @@ describe('display', function()
-- oldtest: Test_display_long_lastline()
it('"lastline" shows correct text when end of wrapped line is deleted', function()
local screen = Screen.new(35, 14)
screen:attach()
exec([[
set display=lastline smoothscroll scrolloff=0
call setline(1, [
@ -183,7 +179,6 @@ describe('display', function()
-- oldtest: Test_display_cursor_long_line()
it("correctly shows line that doesn't fit in the window", function()
local screen = Screen.new(75, 8)
screen:attach()
exec([[
call setline(1, ['a', 'b ' .. 'bbbbb'->repeat(150), 'c'])
norm $j

View File

@ -31,7 +31,6 @@ describe('edit', function()
-- oldtest: Test_edit_insert_reg()
it('inserting a register using CTRL-R', function()
local screen = Screen.new(10, 6)
screen:attach()
feed('a<C-R>')
screen:expect([[
{18:^"} |
@ -55,7 +54,6 @@ describe('edit', function()
-- oldtest: Test_edit_ctrl_r_failed()
it('positioning cursor after CTRL-R expression failed', function()
local screen = Screen.new(60, 6)
screen:attach()
feed('i<C-R>')
screen:expect([[

View File

@ -47,7 +47,6 @@ describe('Ex mode', function()
it('substitute confirmation prompt', function()
command('set noincsearch nohlsearch inccommand=')
local screen = Screen.new(60, 6)
screen:attach()
command([[call setline(1, repeat(['foo foo'], 4))]])
command([[set number]])
feed('gQ')
@ -134,7 +133,6 @@ describe('Ex mode', function()
it('pressing Ctrl-C in :append inside a loop in Ex mode does not hang', function()
local screen = Screen.new(60, 6)
screen:attach()
feed('gQ')
feed('for i in range(1)<CR>')
feed('append<CR>')

View File

@ -19,7 +19,6 @@ describe(':confirm command dialog', function()
local function start_new()
clear()
screen = Screen.new(75, 20)
screen:attach()
end
-- Test for the :confirm command dialog

View File

@ -14,7 +14,6 @@ describe('folding', function()
n.clear()
screen = Screen.new(45, 8)
screen:attach()
end)
it('creation, opening, moving (to the end) and closing', function()

View File

@ -12,7 +12,6 @@ describe(':global', function()
-- oldtest: Test_interrupt_global()
it('can be interrupted using Ctrl-C in cmdline mode vim-patch:9.0.0082', function()
local screen = Screen.new(75, 6)
screen:attach()
exec([[
set nohlsearch noincsearch

View File

@ -15,7 +15,6 @@ before_each(clear)
describe(':highlight', function()
it('is working', function()
local screen = Screen.new(35, 10)
screen:attach()
-- Basic test if ":highlight" doesn't crash
feed_command('set more')
feed(':highlight<CR>')
@ -101,7 +100,6 @@ describe('Visual selection highlight', function()
-- oldtest: Test_visual_sbr()
it("when 'showbreak' is set", function()
local screen = Screen.new(60, 6)
screen:attach()
exec([[
set showbreak=>
call setline(1, 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.')

View File

@ -103,7 +103,6 @@ describe("'listchars'", function()
it('"exceeds" character does not appear in foldcolumn vim-patch:8.2.3121', function()
local screen = Screen.new(60, 10)
screen:attach()
exec([[
call setline(1, ['aaa', '', 'a', 'aaaaaa'])
vsplit

View File

@ -205,7 +205,6 @@ describe('listlbr', function()
-- oldtest: Test_linebreak_reset_restore()
it('cursor position is drawn correctly after operator', function()
local screen = Screen.new(60, 6)
screen:attach()
-- f_wincol() calls validate_cursor()
source([[

View File

@ -215,7 +215,6 @@ describe('linebreak', function()
-- oldtest: Test_visual_ends_before_showbreak()
it("Visual area is correct when it ends before multibyte 'showbreak'", function()
local screen = Screen.new(60, 8)
screen:attach()
exec([[
let &wrap = v:true
let &linebreak = v:true

View File

@ -196,7 +196,6 @@ describe('mapping', function()
-- oldtest: Test_showcmd_part_map()
it("'showcmd' with a partial mapping", function()
local screen = Screen.new(60, 6)
screen:attach()
exec([[
set notimeout showcmd
nnoremap ,a <Ignore>

View File

@ -11,7 +11,6 @@ describe('matchaddpos()', function()
-- oldtest: Test_matchaddpos_dump()
it('can add more than 8 match positions vim-patch:9.0.0620', function()
local screen = Screen.new(60, 14)
screen:attach()
exec([[
call setline(1, ['1234567890123']->repeat(14))
call matchaddpos('Search', range(1, 12)->map({i, v -> [v, v]}))
@ -39,7 +38,6 @@ describe('match highlighting', function()
-- oldtest: Test_match_in_linebreak()
it('does not continue in linebreak vim-patch:8.2.3698', function()
local screen = Screen.new(75, 10)
screen:attach()
exec([=[
set breakindent linebreak breakat+=]
call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
@ -55,7 +53,6 @@ describe('match highlighting', function()
it('is shown with incsearch vim-patch:8.2.3940', function()
local screen = Screen.new(75, 6)
screen:attach()
exec([[
set incsearch
call setline(1, range(20))
@ -82,7 +79,6 @@ describe('match highlighting', function()
it('on a Tab vim-patch:8.2.4062', function()
local screen = Screen.new(75, 10)
screen:attach()
exec([[
set linebreak
call setline(1, "\tix")

View File

@ -11,7 +11,6 @@ describe('matchparen', function()
-- oldtest: Test_visual_block_scroll()
it('redraws properly after scrolling with scrolloff=1', function()
local screen = Screen.new(30, 7)
screen:attach()
exec([[
source $VIMRUNTIME/plugin/matchparen.vim
set scrolloff=1
@ -37,7 +36,6 @@ describe('matchparen', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Cyan1 },
}
screen:attach()
local screen1 = [[
{100:^()} |
@ -79,7 +77,6 @@ describe('matchparen', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Cyan1 },
}
screen:attach()
exec([[
source $VIMRUNTIME/plugin/matchparen.vim
@ -107,7 +104,6 @@ describe('matchparen', function()
-- oldtest: Test_matchparen_pum_clear()
it('is cleared when completion popup is shown', function()
local screen = Screen.new(30, 9)
screen:attach()
exec([[
source $VIMRUNTIME/plugin/matchparen.vim
@ -136,7 +132,6 @@ describe('matchparen', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Cyan1 },
}
screen:attach()
exec([[
source $VIMRUNTIME/plugin/matchparen.vim

View File

@ -17,7 +17,6 @@ describe('messages', function()
-- oldtest: Test_warning_scroll()
it('a warning causes scrolling if and only if it has a stacktrace', function()
screen = Screen.new(75, 6)
screen:attach()
-- When the warning comes from a script, messages are scrolled so that the
-- stacktrace is visible.
@ -45,7 +44,6 @@ describe('messages', function()
-- oldtest: Test_message_not_cleared_after_mode()
it('clearing mode does not remove message', function()
screen = Screen.new(60, 10)
screen:attach()
exec([[
nmap <silent> gx :call DebugSilent('normal')<CR>
vmap <silent> gx :call DebugSilent('visual')<CR>
@ -101,7 +99,6 @@ describe('messages', function()
[1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
[2] = { foreground = Screen.colors.Brown }, -- LineNr
})
screen:attach()
command('call setline(1, range(1, 100))')
@ -394,7 +391,6 @@ describe('messages', function()
-- oldtest: Test_echo_verbose_system()
it('verbose message before echo command', function()
screen = Screen.new(60, 10)
screen:attach()
command('cd ' .. nvim_dir)
api.nvim_set_option_value('shell', './shell-test', {})
@ -494,7 +490,6 @@ describe('messages', function()
-- oldtest: Test_quit_long_message()
it('with control characters can be quit vim-patch:8.2.1844', function()
screen = Screen.new(40, 10)
screen:attach()
feed([[:echom range(9999)->join("\x01")<CR>]])
screen:expect([[
@ -521,7 +516,6 @@ describe('messages', function()
describe('mode is cleared when', function()
before_each(function()
screen = Screen.new(40, 6)
screen:attach()
end)
-- oldtest: Test_mode_message_at_leaving_insert_by_ctrl_c()
@ -591,7 +585,6 @@ describe('messages', function()
-- oldtest: Test_ask_yesno()
it('y/n prompt works', function()
screen = Screen.new(75, 6)
screen:attach()
command('set noincsearch nohlsearch inccommand=')
command('call setline(1, range(1, 2))')
@ -644,7 +637,6 @@ describe('messages', function()
-- oldtest: Test_fileinfo_tabpage_cmdheight()
it("fileinfo works when 'cmdheight' has just decreased", function()
screen = Screen.new(40, 6)
screen:attach()
exec([[
set shortmess-=o
@ -673,7 +665,6 @@ describe('messages', function()
-- oldtest: Test_fileinfo_after_echo()
it('fileinfo does not overwrite echo message vim-patch:8.2.4156', function()
screen = Screen.new(40, 6)
screen:attach()
exec([[
set shortmess-=F

View File

@ -11,7 +11,6 @@ describe(':move', function()
-- oldtest: Test_move_undo()
it('redraws correctly when undone', function()
local screen = Screen.new(60, 10)
screen:attach()
fn.setline(1, { 'First', 'Second', 'Third', 'Fourth' })
feed('gg:move +1<CR>')

View File

@ -15,7 +15,6 @@ describe('normal', function()
before_each(function()
clear()
screen = Screen.new(40, 19)
screen:attach()
end)
-- oldtest: Test_normal_j_below_botline()

View File

@ -17,7 +17,6 @@ describe("'number' and 'relativenumber'", function()
[2] = { foreground = Screen.colors.Blue },
[3] = { foreground = Screen.colors.Green },
})
screen:attach()
exec([[
call setline(1, range(200))
111
@ -86,7 +85,6 @@ describe("'number' and 'relativenumber'", function()
[3] = { background = Screen.colors.Green, foreground = Screen.colors.Black },
[4] = { bold = true, foreground = Screen.colors.Blue },
})
screen:attach()
exec([[
set display=lastline scrolloff=0
call setline(1, range(200)->map('v:val->string()->repeat(40)'))
@ -215,7 +213,6 @@ describe("'number' and 'relativenumber'", function()
-- oldtest: Test_relativenumber_callback()
it('relative line numbers are updated if cursor is moved from timer', function()
local screen = Screen.new(50, 8)
screen:attach()
exec([[
call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
set relativenumber
@ -253,7 +250,6 @@ describe("'number' and 'relativenumber'", function()
-- oldtest: Test_number_insert_delete_lines()
it('line numbers are updated when deleting/inserting lines', function()
local screen = Screen.new(50, 8)
screen:attach()
exec([[
call setline(1, range(1, 7))
set number

View File

@ -32,8 +32,7 @@ describe('set', function()
end)
it('winminheight works', function()
local screen = Screen.new(20, 11)
screen:attach()
local _ = Screen.new(20, 11)
source([[
set wmh=0 stal=2
below sp | wincmd _
@ -45,8 +44,7 @@ describe('set', function()
end)
it('winminheight works with tabline', function()
local screen = Screen.new(20, 11)
screen:attach()
local _ = Screen.new(20, 11)
source([[
set wmh=0 stal=2
split
@ -60,7 +58,6 @@ describe('set', function()
it('scroll works', function()
local screen = Screen.new(42, 16)
screen:attach()
source([[
set scroll=2
set laststatus=2

View File

@ -18,7 +18,6 @@ describe('prompt buffer', function()
before_each(function()
clear()
screen = Screen.new(25, 10)
screen:attach()
command('set laststatus=0 nohidden')
end)
@ -68,10 +67,6 @@ describe('prompt buffer', function()
]])
end
after_each(function()
screen:detach()
end)
-- oldtest: Test_prompt_basic()
it('works', function()
source_script()

View File

@ -10,7 +10,6 @@ describe('put', function()
-- oldtest: Test_put_other_window()
it('above topline in buffer in two splits', function()
local screen = Screen.new(80, 10)
screen:attach()
source([[
40vsplit
0put ='some text at the top'
@ -36,7 +35,6 @@ describe('put', function()
-- oldtest: Test_put_in_last_displayed_line()
it('in last displayed line', function()
local screen = Screen.new(75, 10)
screen:attach()
source([[
autocmd CursorMoved * eval line('w$')
let @a = 'x'->repeat(&columns * 2 - 2)

View File

@ -13,7 +13,6 @@ describe('smoothscroll', function()
before_each(function()
screen = Screen.new(40, 12)
screen:attach()
end)
-- oldtest: Test_CtrlE_CtrlY_stop_at_end()

View File

@ -18,7 +18,6 @@ describe('search cmdline', function()
clear()
command('set nohlsearch inccommand=')
screen = Screen.new(20, 3)
screen:attach()
screen:set_default_attr_ids({
inc = { reverse = true },
err = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
@ -747,7 +746,6 @@ describe('Search highlight', function()
-- oldtest: Test_hlsearch_dump()
it('beyond line end vim-patch:8.2.2542', function()
local screen = Screen.new(50, 6)
screen:attach()
exec([[
set hlsearch noincsearch cursorline
call setline(1, ["xxx", "xxx", "xxx"])
@ -773,7 +771,6 @@ describe('Search highlight', function()
[4] = { background = Screen.colors.Yellow, bold = true }, -- Search
[5] = { background = Screen.colors.LightGrey, bold = true, foreground = Screen.colors.Black },
})
screen:attach()
exec([[
set hlsearch noincsearch
call setline(1, repeat(["xxx yyy zzz"], 3))

View File

@ -15,7 +15,6 @@ describe('search stat', function()
[4] = { reverse = true }, -- IncSearch, TabLineFill
[5] = { foreground = Screen.colors.Red }, -- WarningMsg
})
screen:attach()
end)
-- oldtest: Test_search_stat_screendump()

View File

@ -26,7 +26,6 @@ describe('signs', function()
-- oldtest: Test_sign_cursor_position()
it('are drawn correctly', function()
local screen = Screen.new(75, 6)
screen:attach()
exec([[
call setline(1, [repeat('x', 75), 'mmmm', 'yyyy'])
call cursor(2,1)

View File

@ -18,7 +18,6 @@ describe(':source!', function()
]]
)
local screen = Screen.new(75, 6)
screen:attach()
feed(':source! Xscript.vim\n')
screen:expect([[
^ |

View File

@ -12,7 +12,6 @@ describe('statusline', function()
before_each(function()
screen = Screen.new(50, 7)
screen:attach()
end)
it('is updated in cmdline mode when using window-local statusline vim-patch:8.2.2737', function()

View File

@ -211,7 +211,6 @@ describe(':substitute', function()
it('first char is highlighted with confirmation dialog and empty match', function()
local screen = Screen.new(60, 8)
screen:attach()
exec([[
set nohlsearch noincsearch
call setline(1, ['one', 'two', 'three'])

View File

@ -12,7 +12,6 @@ describe('tabline', function()
before_each(function()
screen = Screen.new(50, 7)
screen:attach()
end)
-- oldtest: Test_tabline_showcmd()

View File

@ -12,7 +12,6 @@ describe('Vim script', function()
-- oldtest: Test_deep_nest()
it('Error when if/for/while/try/function is nested too deep', function()
local screen = Screen.new(80, 24)
screen:attach()
api.nvim_set_option_value('laststatus', 2, {})
exec([[
" Deep nesting of if ... endif
@ -84,7 +83,6 @@ describe('Vim script', function()
-- oldtest: Test_typed_script_var()
it('using s: with a typed command', function()
local screen = Screen.new(80, 24)
screen:attach()
feed(":echo get(s:, 'foo', 'x')\n")
screen:expect({ any = 'E116: ' })
end)

View File

@ -12,7 +12,6 @@ describe('Visual highlight', function()
before_each(function()
screen = Screen.new(50, 6)
screen:attach()
end)
-- oldtest: Test_visual_block_with_virtualedit()

View File

@ -11,7 +11,6 @@ local feed = n.feed
it('scrolling with laststatus=0 and :botright split', function()
clear('--cmd', 'set ruler')
local screen = Screen.new(40, 10)
screen:attach()
exec([[
set laststatus=0
call setline(1, range(1, 100))
@ -38,7 +37,6 @@ describe('splitkeep', function()
before_each(function()
clear('--cmd', 'set splitkeep=screen')
screen = Screen.new()
screen:attach()
end)
-- oldtest: Test_splitkeep_cursor()

View File

@ -344,7 +344,6 @@ describe('lua buffer event callbacks: on_lines', function()
it('setting extmark in on_lines callback works', function()
local screen = Screen.new(40, 6)
screen:attach()
api.nvim_buf_set_lines(0, 0, -1, true, { 'aaa', 'bbb', 'ccc' })
exec_lua(function()

View File

@ -111,7 +111,6 @@ describe(':lua', function()
it('can show multiline error messages', function()
local screen = Screen.new(40, 10)
screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { bold = true, reverse = true },
@ -204,7 +203,6 @@ describe(':lua', function()
it('with range', function()
local screen = Screen.new(40, 10)
screen:attach()
api.nvim_buf_set_lines(0, 0, 0, 0, { 'nonsense', 'function x() print "hello" end', 'x()' })
-- ":{range}lua" fails on invalid Lua code.

View File

@ -18,7 +18,6 @@ describe('vim.hl.range', function()
screen:add_extra_attr_ids({
[100] = { foreground = Screen.colors.Blue, background = Screen.colors.Yellow, bold = true },
})
screen:attach()
api.nvim_set_option_value('list', true, {})
api.nvim_set_option_value('listchars', 'eol:$', {})
api.nvim_buf_set_lines(0, 0, -1, true, {

View File

@ -65,7 +65,6 @@ describe('vim.uv', function()
it('is API safe', function()
local screen = Screen.new(50, 10)
screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { bold = true, reverse = true },

View File

@ -510,7 +510,6 @@ describe('v:lua', function()
it('works in func options', function()
local screen = Screen.new(60, 8)
screen:attach()
api.nvim_set_option_value('omnifunc', 'v:lua.mymod.omni', {})
feed('isome st<c-x><c-o>')
screen:expect{grid=[[

View File

@ -158,7 +158,6 @@ describe('print', function()
it('blank line in message works', function()
local screen = Screen.new(40, 8)
screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { bold = true, foreground = Screen.colors.SeaGreen },
@ -196,7 +195,6 @@ describe('debug.debug', function()
before_each(function()
screen = Screen.new()
screen:attach()
screen:set_default_attr_ids {
[0] = { bold = true, foreground = 255 },
[1] = { bold = true, reverse = true },

View File

@ -39,7 +39,6 @@ describe('vim.secure', function()
it('works', function()
local screen = Screen.new(80, 8)
screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { bold = true, reverse = true },

View File

@ -17,7 +17,6 @@ describe('thread', function()
before_each(function()
clear()
screen = Screen.new(50, 10)
screen:attach()
end)
it('entry func is executed in protected mode', function()
@ -257,7 +256,6 @@ describe('threadpool', function()
it('with invalid return value', function()
local screen = Screen.new(50, 10)
screen:attach()
exec_lua [[
local work = vim.uv.new_work(function() return {} end, function() end)

View File

@ -41,7 +41,6 @@ describe('vim.ui_attach', function()
[6] = { reverse = true, bold = true },
[7] = { background = Screen.colors.Yellow1 },
})
screen:attach()
end)
local function expect_events(expected)
@ -251,8 +250,7 @@ describe('vim.ui_attach', function()
it('error in callback is logged', function()
clear({ env = { NVIM_LOG_FILE = testlog } })
local screen = Screen.new()
screen:attach()
local _ = Screen.new()
exec_lua([[
local ns = vim.api.nvim_create_namespace('testspace')
vim.ui_attach(ns, { ext_popupmenu = true }, function() error(42) end)

View File

@ -637,7 +637,6 @@ describe('lua stdlib', function()
matches('big failure\nvery async', remove_trace(eval('v:errmsg')))
local screen = Screen.new(60, 5)
screen:attach()
screen:expect {
grid = [[
^ |
@ -1403,7 +1402,6 @@ describe('lua stdlib', function()
end)
local screen = Screen.new(50, 7)
screen:attach()
exec_lua([[
timer = vim.uv.new_timer()
timer:start(20, 0, function ()
@ -2130,7 +2128,6 @@ describe('lua stdlib', function()
eq({ 1, 5 }, api.nvim_win_get_cursor(0))
local screen = Screen.new(60, 3)
screen:attach()
eq(1, eval('v:hlsearch'))
screen:expect {
grid = [[
@ -3401,7 +3398,6 @@ stack traceback:
it('callback is not invoked recursively #30752', function()
local screen = Screen.new(60, 10)
screen:attach()
exec_lua([[
vim.on_key(function(key, typed)
vim.api.nvim_echo({
@ -3779,7 +3775,6 @@ stack traceback:
it('fails in fast callbacks #26122', function()
local screen = Screen.new(80, 10)
screen:attach()
exec_lua([[
local timer = vim.uv.new_timer()
timer:start(0, 0, function()
@ -3797,7 +3792,6 @@ stack traceback:
it('vim.notify_once', function()
local screen = Screen.new(60, 5)
screen:attach()
screen:expect {
grid = [[
^ |
@ -3994,7 +3988,6 @@ stack traceback:
it('updates ruler if cursor moved', function()
-- Fixed for win_execute in vim-patch:8.1.2124, but should've applied to nvim_win_call too!
local screen = Screen.new(30, 5)
screen:attach()
exec_lua [[
_G.api = vim.api
vim.opt.ruler = true
@ -4137,7 +4130,6 @@ stack traceback:
it('vim.lua_omnifunc', function()
local screen = Screen.new(60, 5)
screen:attach()
command [[ set omnifunc=v:lua.vim.lua_omnifunc ]]
-- Note: the implementation is shared with lua command line completion.

View File

@ -1029,7 +1029,6 @@ describe('vim._with', function()
[1] = { bold = true, reverse = true },
[2] = { bold = true, foreground = Screen.colors.Blue },
}
screen:attach()
exec_lua [[ vim._with({ silent = true }, function() vim.cmd.echo('"ccc"') end) ]]
screen:expect [[
^ |
@ -1178,7 +1177,6 @@ describe('vim._with', function()
[1] = { reverse = true },
[2] = { bold = true, reverse = true },
}
screen:attach()
exec_lua [[
vim.opt.ruler = true
local lines = {}

View File

@ -16,7 +16,6 @@ describe("'belloff'", function()
before_each(function()
clear()
screen = Screen.new(42, 5)
screen:attach()
screen:expect([[
^ |
{1:~ }|*3

View File

@ -16,7 +16,6 @@ describe("'fillchars'", function()
before_each(function()
clear()
screen = Screen.new(25, 5)
screen:attach()
end)
describe('"eob" flag', function()
@ -157,7 +156,6 @@ describe("'listchars'", function()
before_each(function()
clear()
screen = Screen.new(50, 5)
screen:attach()
end)
it('has global value', function()

View File

@ -18,7 +18,6 @@ describe("'cursorbind'", function()
[3] = { reverse = true }, -- StatusLineNC
[4] = { background = Screen.colors.Grey90 }, -- CursorLine, CursorColumn
})
screen:attach()
exec([[
call setline(1, 'aa bb cc dd ee ff gg hh ii jj kk ll mm' ..
\ ' nn oo pp qq rr ss tt uu vv ww xx yy zz')

View File

@ -34,7 +34,6 @@ describe('startup defaults', function()
describe(':filetype', function()
local function expect_filetype(expected)
local screen = Screen.new(50, 4)
screen:attach()
command('filetype')
screen:expect([[
^ |
@ -127,7 +126,6 @@ describe('startup defaults', function()
it('vert/fold flags', function()
clear()
local screen = Screen.new(50, 5)
screen:attach()
command('set laststatus=0')
insert([[
1

View File

@ -14,7 +14,6 @@ describe("'shortmess'", function()
before_each(function()
clear()
screen = Screen.new(42, 5)
screen:attach()
end)
describe('"F" flag', function()

View File

@ -155,7 +155,6 @@ describe('vim.health', function()
it('highlights OK, ERROR', function()
local screen = Screen.new(50, 12)
screen:attach()
screen:set_default_attr_ids({
h1 = { reverse = true },
h2 = { foreground = tonumber('0x6a0dad') },
@ -222,7 +221,7 @@ describe(':checkhealth window', function()
end)
it('opens directly if no buffer created', function()
local screen = Screen.new(50, 12)
local screen = Screen.new(50, 12, { ext_multigrid = true })
screen:set_default_attr_ids {
h1 = { reverse = true },
h2 = { foreground = tonumber('0x6a0dad') },
@ -230,7 +229,6 @@ describe(':checkhealth window', function()
[14] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
[32] = { foreground = Screen.colors.PaleGreen2 },
}
screen:attach({ ext_multigrid = true })
command('checkhealth success1')
screen:expect {
grid = [[
@ -256,7 +254,7 @@ describe(':checkhealth window', function()
end)
local function test_health_vsplit(left, emptybuf, mods)
local screen = Screen.new(50, 20)
local screen = Screen.new(50, 20, { ext_multigrid = true })
screen:set_default_attr_ids {
h1 = { reverse = true },
h2 = { foreground = tonumber('0x6a0dad') },
@ -264,7 +262,6 @@ describe(':checkhealth window', function()
[14] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
[32] = { foreground = Screen.colors.PaleGreen2 },
}
screen:attach({ ext_multigrid = true })
if not emptybuf then
insert('hello')
end
@ -322,8 +319,7 @@ describe(':checkhealth window', function()
end
local function test_health_split(top, emptybuf, mods)
local screen = Screen.new(50, 25)
screen:attach({ ext_multigrid = true })
local screen = Screen.new(50, 25, { ext_multigrid = true })
screen._default_attr_ids = nil
if not emptybuf then
insert('hello')

View File

@ -67,7 +67,6 @@ int main() {
before_each(function()
clear_notrace()
screen = Screen.new(50, 9)
screen:attach()
bufnr = n.api.nvim_get_current_buf()
exec_lua(create_server_definition)
@ -339,7 +338,6 @@ test text
before_each(function()
clear_notrace()
screen = Screen.new(50, 3)
screen:attach()
exec_lua(create_server_definition)
bufnr = n.api.nvim_get_current_buf()

View File

@ -28,7 +28,6 @@ describe('semantic token highlighting', function()
local screen --- @type test.functional.ui.screen
before_each(function()
screen = Screen.new(40, 16)
screen:attach()
screen:set_default_attr_ids {
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { foreground = Screen.colors.DarkCyan },

View File

@ -181,11 +181,9 @@ describe('vim.lsp.util', function()
eq(expected_anchor, string.sub(opts.anchor, 1, 1))
end
local screen --- @type test.functional.ui.screen
before_each(function()
n.clear()
screen = Screen.new(80, 80)
screen:attach()
local _ = Screen.new(80, 80)
feed('79i<CR><Esc>') -- fill screen with empty lines
end)

View File

@ -60,7 +60,6 @@ describe(':Man', function()
c = { foreground = Screen.colors.Blue }, -- control chars
eob = { bold = true, foreground = Screen.colors.Blue }, -- empty line '~'s
})
screen:attach()
end)
it('clears backspaces from text and adds highlights', function()

View File

@ -14,7 +14,6 @@ describe('matchparen', function()
before_each(function()
clear { args = { '-u', 'NORC' } }
screen = Screen.new(20, 5)
screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = 255 },
[1] = { bold = true },

View File

@ -3053,7 +3053,6 @@ describe('syntax/shada.vim', function()
[7] = { bold = true, reverse = true },
[8] = { bold = true, foreground = Screen.colors.Blue },
}
screen:attach()
api.nvim_buf_set_lines(0, 0, 1, true, {
'Header with timestamp ' .. epoch .. ':',

Some files were not shown because too many files have changed in this diff Show More