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

View File

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

View File

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

View File

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

View File

@@ -366,7 +366,6 @@ describe('API', function()
it('displays messages when opts.output=false', function() it('displays messages when opts.output=false', function()
local screen = Screen.new(40, 8) local screen = Screen.new(40, 8)
screen:attach()
api.nvim_exec2("echo 'hello'", { output = false }) api.nvim_exec2("echo 'hello'", { output = false })
screen:expect { screen:expect {
grid = [[ grid = [[
@@ -379,7 +378,6 @@ describe('API', function()
it("doesn't display messages when output=true", function() it("doesn't display messages when output=true", function()
local screen = Screen.new(40, 6) local screen = Screen.new(40, 6)
screen:attach()
api.nvim_exec2("echo 'hello'", { output = true }) api.nvim_exec2("echo 'hello'", { output = true })
screen:expect { screen:expect {
grid = [[ grid = [[
@@ -1278,7 +1276,6 @@ describe('API', function()
end) end)
it('pasting with empty last chunk in Cmdline mode', function() it('pasting with empty last chunk in Cmdline mode', function()
local screen = Screen.new(20, 4) local screen = Screen.new(20, 4)
screen:attach()
feed(':') feed(':')
api.nvim_paste('Foo', true, 1) api.nvim_paste('Foo', true, 1)
api.nvim_paste('', true, 3) api.nvim_paste('', true, 3)
@@ -1290,7 +1287,6 @@ describe('API', function()
end) end)
it('pasting text with control characters in Cmdline mode', function() it('pasting text with control characters in Cmdline mode', function()
local screen = Screen.new(20, 4) local screen = Screen.new(20, 4)
screen:attach()
feed(':') feed(':')
api.nvim_paste('normal! \023\022\006\027', true, -1) api.nvim_paste('normal! \023\022\006\027', true, -1)
screen:expect([[ screen:expect([[
@@ -1675,7 +1671,6 @@ describe('API', function()
eq({ 1, 5 }, api.nvim_win_get_cursor(0)) eq({ 1, 5 }, api.nvim_win_get_cursor(0))
local screen = Screen.new(60, 3) local screen = Screen.new(60, 3)
screen:attach()
eq(1, eval('v:hlsearch')) eq(1, eval('v:hlsearch'))
screen:expect { screen:expect {
grid = [[ grid = [[
@@ -2130,7 +2125,6 @@ describe('API', function()
it('does not complete ("interrupt") `d` #3732', function() it('does not complete ("interrupt") `d` #3732', function()
local screen = Screen.new(20, 4) local screen = Screen.new(20, 4)
screen:attach()
command('set listchars=eol:$') command('set listchars=eol:$')
command('set list') command('set list')
feed('ia<cr>b<cr>c<cr><Esc>kkk') feed('ia<cr>b<cr>c<cr><Esc>kkk')
@@ -2391,7 +2385,6 @@ describe('API', function()
before_each(function() before_each(function()
screen = Screen.new(40, 8) screen = Screen.new(40, 8)
screen:attach()
end) end)
it('prints long messages correctly #20534', function() it('prints long messages correctly #20534', function()
@@ -2461,7 +2454,6 @@ describe('API', function()
before_each(function() before_each(function()
screen = Screen.new(40, 8) screen = Screen.new(40, 8)
screen:attach()
end) end)
it('can show one line', function() it('can show one line', function()
@@ -2543,7 +2535,6 @@ describe('API', function()
before_each(function() before_each(function()
screen = Screen.new(40, 8) screen = Screen.new(40, 8)
screen:attach()
end) end)
it('shows only one return prompt after all lines are shown', function() it('shows only one return prompt after all lines are shown', function()
@@ -3100,8 +3091,7 @@ describe('API', function()
eq({}, api.nvim_list_uis()) eq({}, api.nvim_list_uis())
end) end)
it('returns attached UIs', function() it('returns attached UIs', function()
local screen = Screen.new(20, 4) local screen = Screen.new(20, 4, { override = true })
screen:attach({ override = true })
local expected = { local expected = {
{ {
chan = 1, chan = 1,
@@ -3129,8 +3119,7 @@ describe('API', function()
eq(expected, api.nvim_list_uis()) eq(expected, api.nvim_list_uis())
screen:detach() screen:detach()
screen = Screen.new(44, 99) screen = Screen.new(44, 99, { rgb = false }) -- luacheck: ignore
screen:attach({ rgb = false })
expected[1].rgb = false expected[1].rgb = false
expected[1].override = false expected[1].override = false
expected[1].width = 44 expected[1].width = 44
@@ -3165,7 +3154,6 @@ describe('API', function()
eq(1, api.nvim_get_current_buf()) eq(1, api.nvim_get_current_buf())
local screen = Screen.new(20, 4) local screen = Screen.new(20, 4)
screen:attach()
api.nvim_buf_set_lines(2, 0, -1, true, { 'some text' }) api.nvim_buf_set_lines(2, 0, -1, true, { 'some text' })
api.nvim_set_current_buf(2) api.nvim_set_current_buf(2)
screen:expect( screen:expect(
@@ -3229,7 +3217,6 @@ describe('API', function()
eq(1, api.nvim_get_current_buf()) eq(1, api.nvim_get_current_buf())
local screen = Screen.new(20, 4) local screen = Screen.new(20, 4)
screen:attach()
-- --
-- Editing a scratch-buffer does NOT change its properties. -- Editing a scratch-buffer does NOT change its properties.
@@ -3591,7 +3578,6 @@ describe('API', function()
before_each(function() before_each(function()
screen = Screen.new(40, 8) screen = Screen.new(40, 8)
screen:attach()
command('highlight Statement gui=bold guifg=Brown') command('highlight Statement gui=bold guifg=Brown')
command('highlight Special guifg=SlateBlue') command('highlight Special guifg=SlateBlue')
end) end)
@@ -3654,7 +3640,6 @@ describe('API', function()
before_each(function() before_each(function()
screen = Screen.new(100, 35) screen = Screen.new(100, 35)
screen:attach()
screen:add_extra_attr_ids { screen:add_extra_attr_ids {
[100] = { background = tonumber('0xffff40'), bg_indexed = true }, [100] = { background = tonumber('0xffff40'), bg_indexed = true },
[101] = { [101] = {
@@ -3933,7 +3918,6 @@ describe('API', function()
command('set readonly') command('set readonly')
eq({ str = '[RO]', width = 4 }, api.nvim_eval_statusline('%r', { maxwidth = 5 })) eq({ str = '[RO]', width = 4 }, api.nvim_eval_statusline('%r', { maxwidth = 5 }))
local screen = Screen.new(80, 24) local screen = Screen.new(80, 24)
screen:attach()
command('set showcmd') command('set showcmd')
feed('1234') feed('1234')
screen:expect({ any = '1234' }) screen:expect({ any = '1234' })
@@ -4591,7 +4575,6 @@ describe('API', function()
end) end)
it('does not interfere with printing line in Ex mode #19400', function() it('does not interfere with printing line in Ex mode #19400', function()
local screen = Screen.new(60, 7) local screen = Screen.new(60, 7)
screen:attach()
insert([[ insert([[
foo foo
bar]]) bar]])
@@ -5048,7 +5031,6 @@ describe('API', function()
it("doesn't display messages when output=true", function() it("doesn't display messages when output=true", function()
local screen = Screen.new(40, 6) local screen = Screen.new(40, 6)
screen:attach()
api.nvim_cmd({ cmd = 'echo', args = { [['hello']] } }, { output = true }) api.nvim_cmd({ cmd = 'echo', args = { [['hello']] } }, { output = true })
screen:expect { screen:expect {
grid = [[ grid = [[
@@ -5131,7 +5113,6 @@ describe('API', function()
it('nvim__redraw', function() it('nvim__redraw', function()
local screen = Screen.new(60, 5) 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, {}))
eq('at least one action required', pcall_err(api.nvim__redraw, { buf = 0 })) 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 })) 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() it('updates the screen, and also when the window is unfocused', function()
local screen = Screen.new(30, 9) local screen = Screen.new(30, 9)
screen:attach()
insert('prologue') insert('prologue')
feed('100o<esc>') feed('100o<esc>')
@@ -281,7 +280,6 @@ describe('API/win', function()
it('updates cursorline and statusline ruler in non-current window', function() it('updates cursorline and statusline ruler in non-current window', function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:attach()
command('set ruler') command('set ruler')
command('set cursorline') command('set cursorline')
insert([[ insert([[
@@ -314,7 +312,6 @@ describe('API/win', function()
it('updates cursorcolumn in non-current window', function() it('updates cursorcolumn in non-current window', function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:attach()
command('set cursorcolumn') command('set cursorcolumn')
insert([[ insert([[
aaa aaa
@@ -857,7 +854,6 @@ describe('API/win', function()
it('with two diff windows', function() it('with two diff windows', function()
local X = api.nvim_get_vvar('maxcol') local X = api.nvim_get_vvar('maxcol')
local screen = Screen.new(45, 22) local screen = Screen.new(45, 22)
screen:attach()
exec([[ exec([[
set diffopt+=context:2 number set diffopt+=context:2 number
let expr = 'printf("%08d", v:val) .. repeat("!", v:val)' let expr = 'printf("%08d", v:val) .. repeat("!", v:val)'
@@ -975,7 +971,6 @@ describe('API/win', function()
it('with wrapped lines', function() it('with wrapped lines', function()
local X = api.nvim_get_vvar('maxcol') local X = api.nvim_get_vvar('maxcol')
local screen = Screen.new(45, 22) local screen = Screen.new(45, 22)
screen:attach()
exec([[ exec([[
set number cpoptions+=n set number cpoptions+=n
call setline(1, repeat([repeat('foobar-', 36)], 3)) call setline(1, repeat([repeat('foobar-', 36)], 3))
@@ -2557,7 +2552,6 @@ describe('API/win', function()
it('updates statusline when moving bottom split', function() it('updates statusline when moving bottom split', function()
local screen = Screen.new(10, 10) local screen = Screen.new(10, 10)
screen:attach()
exec([[ exec([[
set laststatus=0 set laststatus=0
belowright split belowright split

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -498,7 +498,6 @@ describe('jobs', function()
it('can redefine callbacks being used by a job', function() it('can redefine callbacks being used by a job', function()
local screen = Screen.new() local screen = Screen.new()
screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, [1] = { bold = true, foreground = Screen.colors.Blue },
}) })
@@ -524,7 +523,6 @@ describe('jobs', function()
it('requires funcrefs for script-local (s:) functions', function() it('requires funcrefs for script-local (s:) functions', function()
local screen = Screen.new(60, 5) local screen = Screen.new(60, 5)
screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 }, [1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red }, [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() it('hides cursor and flushes messages before blocking', function()
local screen = Screen.new(50, 6) local screen = Screen.new(50, 6)
screen:attach()
command([[let g:id = jobstart([v:progpath, '--clean', '--headless'])]]) command([[let g:id = jobstart([v:progpath, '--clean', '--headless'])]])
source([[ source([[
func PrintAndWait() func PrintAndWait()
@@ -1223,7 +1220,6 @@ describe('pty process teardown', function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(30, 6) screen = Screen.new(30, 6)
screen:attach()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }|*4 {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() it('does not crash after reading from stdin in non-headless mode', function()
skip(is_os('win')) skip(is_os('win'))
local screen = Screen.new(40, 8) local screen = Screen.new(40, 8)
screen:attach()
local args = { local args = {
nvim_prog_abs(), nvim_prog_abs(),
'-u', '-u',

View File

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

View File

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

View File

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

View File

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

View File

@@ -56,7 +56,6 @@ describe('jumplist', function()
write_file(fname2, 'baz') write_file(fname2, 'baz')
local screen = Screen.new(5, 25) local screen = Screen.new(5, 25)
screen:attach()
command('set number') command('set number')
command('edit ' .. fname1) command('edit ' .. fname1)
feed('35gg') feed('35gg')
@@ -386,7 +385,6 @@ describe('jumpoptions=view', function()
it('restores the view', function() it('restores the view', function()
local screen = Screen.new(5, 8) local screen = Screen.new(5, 8)
screen:attach()
command('edit ' .. file1) command('edit ' .. file1)
feed('12Gztj') feed('12Gztj')
feed('gg<C-o>') feed('gg<C-o>')
@@ -404,7 +402,6 @@ describe('jumpoptions=view', function()
it('restores the view across files', function() it('restores the view across files', function()
local screen = Screen.new(5, 5) local screen = Screen.new(5, 5)
screen:attach()
command('args ' .. file1 .. ' ' .. file2) command('args ' .. file1 .. ' ' .. file2)
feed('12Gzt') feed('12Gzt')
command('next') command('next')
@@ -428,7 +425,6 @@ describe('jumpoptions=view', function()
it('restores the view across files with <C-^>', function() it('restores the view across files with <C-^>', function()
local screen = Screen.new(5, 5) local screen = Screen.new(5, 5)
screen:attach()
command('args ' .. file1 .. ' ' .. file2) command('args ' .. file1 .. ' ' .. file2)
feed('12Gzt') feed('12Gzt')
command('next') command('next')
@@ -452,7 +448,6 @@ describe('jumpoptions=view', function()
it("falls back to standard behavior when view can't be recovered", function() it("falls back to standard behavior when view can't be recovered", function()
local screen = Screen.new(5, 8) local screen = Screen.new(5, 8)
screen:attach()
command('edit ' .. file1) command('edit ' .. file1)
feed('7GzbG') feed('7GzbG')
api.nvim_buf_set_lines(0, 0, 2, true, {}) 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() it('falls back to standard behavior for a mark without a view', function()
local screen = Screen.new(5, 8) local screen = Screen.new(5, 8)
screen:attach()
command('edit ' .. file1) command('edit ' .. file1)
feed('10ggzzvwy') feed('10ggzzvwy')
screen:expect([[ 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() it('is restored in normal mode but not op-pending mode', function()
local screen = Screen.new(5, 8) local screen = Screen.new(5, 8)
screen:attach()
command('edit ' .. file1) command('edit ' .. file1)
feed('<C-e>jWma') feed('<C-e>jWma')
feed("G'a") feed("G'a")
@@ -390,7 +389,6 @@ describe('named marks view', function()
it('is restored across files', function() it('is restored across files', function()
local screen = Screen.new(5, 5) local screen = Screen.new(5, 5)
screen:attach()
command('args ' .. file1 .. ' ' .. file2) command('args ' .. file1 .. ' ' .. file2)
feed('<C-e>mA') feed('<C-e>mA')
local mark_view = [[ local mark_view = [[
@@ -415,7 +413,6 @@ describe('named marks view', function()
it("fallback to standard behavior when view can't be recovered", function() it("fallback to standard behavior when view can't be recovered", function()
local screen = Screen.new(10, 10) local screen = Screen.new(10, 10)
screen:attach()
command('edit ' .. file1) command('edit ' .. file1)
feed('7GzbmaG') -- Seven lines from the top feed('7GzbmaG') -- Seven lines from the top
command('new') -- Screen size for window is now half the height can't be restored 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() it('fallback to standard behavior when mark is loaded from shada', function()
local screen = Screen.new(10, 6) local screen = Screen.new(10, 6)
screen:attach()
command('edit ' .. file1) command('edit ' .. file1)
feed('G') feed('G')
feed('mA') feed('mA')

View File

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

View File

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

View File

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

View File

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

View File

@@ -105,7 +105,6 @@ describe('tabpage', function()
screen:add_extra_attr_ids { screen:add_extra_attr_ids {
[100] = { bold = true, foreground = Screen.colors.Fuchsia }, [100] = { bold = true, foreground = Screen.colors.Fuchsia },
} }
screen:attach()
command('tabnew') command('tabnew')
command('tabprev') 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 }, [1] = { bold = true, foreground = Screen.colors.Blue },
[2] = { bold = true, reverse = true }, [2] = { bold = true, reverse = true },
}) })
screen:attach()
end) end)
it('using :append', function() it('using :append', function()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -103,7 +103,6 @@ describe('Screen', function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(20, 5) screen = Screen.new(20, 5)
screen:attach()
end) end)
it('cursor is restored after :map <expr> which calls input()', function() 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 cwd_dir = fn.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '')
local session_path = cwd_dir .. '/' .. session_file local session_path = cwd_dir .. '/' .. session_file
screen = Screen.new(50, 6) screen = Screen.new(50, 6, { rgb = false })
screen:attach({ rgb = false })
local expected_screen = [[ local expected_screen = [[
^/ | ^/ |
| |
@@ -222,8 +221,7 @@ describe(':mksession', function()
-- Create a new test instance of Nvim. -- Create a new test instance of Nvim.
clear() clear()
screen = Screen.new(50, 6) screen = Screen.new(50, 6, { rgb = false })
screen:attach({ rgb = false })
command('silent source ' .. session_path) command('silent source ' .. session_path)
-- Verify that the terminal's working directory is "/". -- Verify that the terminal's working directory is "/".

View File

@@ -38,7 +38,6 @@ describe(':oldfiles', function()
it('shows most recently used files', function() it('shows most recently used files', function()
local screen = Screen.new(100, 5) local screen = Screen.new(100, 5)
screen:attach()
screen._default_attr_ids = nil screen._default_attr_ids = nil
feed_command('edit testfile1') feed_command('edit testfile1')
feed_command('edit testfile2') 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() it('jump message does not scroll with cmdheight=0 and shm+=O #29597', function()
local screen = Screen.new(40, 6) local screen = Screen.new(40, 6)
screen:attach()
command('set cmdheight=0') command('set cmdheight=0')
local file = file_base .. '_reuse_qfbuf_BufAdd' local file = file_base .. '_reuse_qfbuf_BufAdd'
write_file(file, 'foobar') 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 [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { reverse = true }, -- IncSearch [1] = { reverse = true }, -- IncSearch
}) })
screen:attach()
feed('i→<Esc>:vimgrep →') feed('i→<Esc>:vimgrep →')
screen:expect([[ screen:expect([[
{1:→} | {1:→} |

View File

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

View File

@@ -14,7 +14,6 @@ describe('example', function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(20, 5) screen = Screen.new(20, 5)
screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, [0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { bold = true, foreground = Screen.colors.Brown }, [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. -- The UI must declare that it wants to handle the UI events.
-- For this example, we enable `ext_tabline`: -- For this example, we enable `ext_tabline`:
screen:detach() screen:detach()
screen = Screen.new(25, 5) screen = Screen.new(25, 5, { rgb = true, ext_tabline = true })
screen:attach({ rgb = true, ext_tabline = true })
-- From ":help ui" we find that `tabline_update` receives `curtab` and -- From ":help ui" we find that `tabline_update` receives `curtab` and
-- `tabs` objects. So we declare the UI handler like this: -- `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() it('is working', function()
local screen = Screen.new(40, 5) local screen = Screen.new(40, 5)
screen:attach()
command('highlight MyGroup1 term=bold ctermbg=red guibg=red') command('highlight MyGroup1 term=bold ctermbg=red guibg=red')
command('highlight MyGroup2 term=italic ctermbg=green guibg=green') command('highlight MyGroup2 term=italic ctermbg=green guibg=green')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -15,7 +15,6 @@ before_each(clear)
describe(':highlight', function() describe(':highlight', function()
it('is working', function() it('is working', function()
local screen = Screen.new(35, 10) local screen = Screen.new(35, 10)
screen:attach()
-- Basic test if ":highlight" doesn't crash -- Basic test if ":highlight" doesn't crash
feed_command('set more') feed_command('set more')
feed(':highlight<CR>') feed(':highlight<CR>')
@@ -101,7 +100,6 @@ describe('Visual selection highlight', function()
-- oldtest: Test_visual_sbr() -- oldtest: Test_visual_sbr()
it("when 'showbreak' is set", function() it("when 'showbreak' is set", function()
local screen = Screen.new(60, 6) local screen = Screen.new(60, 6)
screen:attach()
exec([[ exec([[
set showbreak=> 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.') 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() it('"exceeds" character does not appear in foldcolumn vim-patch:8.2.3121', function()
local screen = Screen.new(60, 10) local screen = Screen.new(60, 10)
screen:attach()
exec([[ exec([[
call setline(1, ['aaa', '', 'a', 'aaaaaa']) call setline(1, ['aaa', '', 'a', 'aaaaaa'])
vsplit vsplit

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -12,7 +12,6 @@ describe('statusline', function()
before_each(function() before_each(function()
screen = Screen.new(50, 7) screen = Screen.new(50, 7)
screen:attach()
end) end)
it('is updated in cmdline mode when using window-local statusline vim-patch:8.2.2737', function() 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() it('first char is highlighted with confirmation dialog and empty match', function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:attach()
exec([[ exec([[
set nohlsearch noincsearch set nohlsearch noincsearch
call setline(1, ['one', 'two', 'three']) call setline(1, ['one', 'two', 'three'])

View File

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

View File

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

View File

@@ -12,7 +12,6 @@ describe('Visual highlight', function()
before_each(function() before_each(function()
screen = Screen.new(50, 6) screen = Screen.new(50, 6)
screen:attach()
end) end)
-- oldtest: Test_visual_block_with_virtualedit() -- 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() it('scrolling with laststatus=0 and :botright split', function()
clear('--cmd', 'set ruler') clear('--cmd', 'set ruler')
local screen = Screen.new(40, 10) local screen = Screen.new(40, 10)
screen:attach()
exec([[ exec([[
set laststatus=0 set laststatus=0
call setline(1, range(1, 100)) call setline(1, range(1, 100))
@@ -38,7 +37,6 @@ describe('splitkeep', function()
before_each(function() before_each(function()
clear('--cmd', 'set splitkeep=screen') clear('--cmd', 'set splitkeep=screen')
screen = Screen.new() screen = Screen.new()
screen:attach()
end) end)
-- oldtest: Test_splitkeep_cursor() -- 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() it('setting extmark in on_lines callback works', function()
local screen = Screen.new(40, 6) local screen = Screen.new(40, 6)
screen:attach()
api.nvim_buf_set_lines(0, 0, -1, true, { 'aaa', 'bbb', 'ccc' }) api.nvim_buf_set_lines(0, 0, -1, true, { 'aaa', 'bbb', 'ccc' })
exec_lua(function() exec_lua(function()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -17,7 +17,6 @@ describe('thread', function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(50, 10) screen = Screen.new(50, 10)
screen:attach()
end) end)
it('entry func is executed in protected mode', function() it('entry func is executed in protected mode', function()
@@ -257,7 +256,6 @@ describe('threadpool', function()
it('with invalid return value', function() it('with invalid return value', function()
local screen = Screen.new(50, 10) local screen = Screen.new(50, 10)
screen:attach()
exec_lua [[ exec_lua [[
local work = vim.uv.new_work(function() return {} end, function() end) 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 }, [6] = { reverse = true, bold = true },
[7] = { background = Screen.colors.Yellow1 }, [7] = { background = Screen.colors.Yellow1 },
}) })
screen:attach()
end) end)
local function expect_events(expected) local function expect_events(expected)
@@ -251,8 +250,7 @@ describe('vim.ui_attach', function()
it('error in callback is logged', function() it('error in callback is logged', function()
clear({ env = { NVIM_LOG_FILE = testlog } }) clear({ env = { NVIM_LOG_FILE = testlog } })
local screen = Screen.new() local _ = Screen.new()
screen:attach()
exec_lua([[ exec_lua([[
local ns = vim.api.nvim_create_namespace('testspace') local ns = vim.api.nvim_create_namespace('testspace')
vim.ui_attach(ns, { ext_popupmenu = true }, function() error(42) end) 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'))) matches('big failure\nvery async', remove_trace(eval('v:errmsg')))
local screen = Screen.new(60, 5) local screen = Screen.new(60, 5)
screen:attach()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
@@ -1403,7 +1402,6 @@ describe('lua stdlib', function()
end) end)
local screen = Screen.new(50, 7) local screen = Screen.new(50, 7)
screen:attach()
exec_lua([[ exec_lua([[
timer = vim.uv.new_timer() timer = vim.uv.new_timer()
timer:start(20, 0, function () timer:start(20, 0, function ()
@@ -2130,7 +2128,6 @@ describe('lua stdlib', function()
eq({ 1, 5 }, api.nvim_win_get_cursor(0)) eq({ 1, 5 }, api.nvim_win_get_cursor(0))
local screen = Screen.new(60, 3) local screen = Screen.new(60, 3)
screen:attach()
eq(1, eval('v:hlsearch')) eq(1, eval('v:hlsearch'))
screen:expect { screen:expect {
grid = [[ grid = [[
@@ -3401,7 +3398,6 @@ stack traceback:
it('callback is not invoked recursively #30752', function() it('callback is not invoked recursively #30752', function()
local screen = Screen.new(60, 10) local screen = Screen.new(60, 10)
screen:attach()
exec_lua([[ exec_lua([[
vim.on_key(function(key, typed) vim.on_key(function(key, typed)
vim.api.nvim_echo({ vim.api.nvim_echo({
@@ -3779,7 +3775,6 @@ stack traceback:
it('fails in fast callbacks #26122', function() it('fails in fast callbacks #26122', function()
local screen = Screen.new(80, 10) local screen = Screen.new(80, 10)
screen:attach()
exec_lua([[ exec_lua([[
local timer = vim.uv.new_timer() local timer = vim.uv.new_timer()
timer:start(0, 0, function() timer:start(0, 0, function()
@@ -3797,7 +3792,6 @@ stack traceback:
it('vim.notify_once', function() it('vim.notify_once', function()
local screen = Screen.new(60, 5) local screen = Screen.new(60, 5)
screen:attach()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
@@ -3994,7 +3988,6 @@ stack traceback:
it('updates ruler if cursor moved', function() 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! -- 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) local screen = Screen.new(30, 5)
screen:attach()
exec_lua [[ exec_lua [[
_G.api = vim.api _G.api = vim.api
vim.opt.ruler = true vim.opt.ruler = true
@@ -4137,7 +4130,6 @@ stack traceback:
it('vim.lua_omnifunc', function() it('vim.lua_omnifunc', function()
local screen = Screen.new(60, 5) local screen = Screen.new(60, 5)
screen:attach()
command [[ set omnifunc=v:lua.vim.lua_omnifunc ]] command [[ set omnifunc=v:lua.vim.lua_omnifunc ]]
-- Note: the implementation is shared with lua command line completion. -- 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 }, [1] = { bold = true, reverse = true },
[2] = { bold = true, foreground = Screen.colors.Blue }, [2] = { bold = true, foreground = Screen.colors.Blue },
} }
screen:attach()
exec_lua [[ vim._with({ silent = true }, function() vim.cmd.echo('"ccc"') end) ]] exec_lua [[ vim._with({ silent = true }, function() vim.cmd.echo('"ccc"') end) ]]
screen:expect [[ screen:expect [[
^ | ^ |
@@ -1178,7 +1177,6 @@ describe('vim._with', function()
[1] = { reverse = true }, [1] = { reverse = true },
[2] = { bold = true, reverse = true }, [2] = { bold = true, reverse = true },
} }
screen:attach()
exec_lua [[ exec_lua [[
vim.opt.ruler = true vim.opt.ruler = true
local lines = {} local lines = {}

View File

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

View File

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

View File

@@ -18,7 +18,6 @@ describe("'cursorbind'", function()
[3] = { reverse = true }, -- StatusLineNC [3] = { reverse = true }, -- StatusLineNC
[4] = { background = Screen.colors.Grey90 }, -- CursorLine, CursorColumn [4] = { background = Screen.colors.Grey90 }, -- CursorLine, CursorColumn
}) })
screen:attach()
exec([[ exec([[
call setline(1, 'aa bb cc dd ee ff gg hh ii jj kk ll mm' .. 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') \ ' 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() describe(':filetype', function()
local function expect_filetype(expected) local function expect_filetype(expected)
local screen = Screen.new(50, 4) local screen = Screen.new(50, 4)
screen:attach()
command('filetype') command('filetype')
screen:expect([[ screen:expect([[
^ | ^ |
@@ -127,7 +126,6 @@ describe('startup defaults', function()
it('vert/fold flags', function() it('vert/fold flags', function()
clear() clear()
local screen = Screen.new(50, 5) local screen = Screen.new(50, 5)
screen:attach()
command('set laststatus=0') command('set laststatus=0')
insert([[ insert([[
1 1

View File

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

View File

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

View File

@@ -67,7 +67,6 @@ int main() {
before_each(function() before_each(function()
clear_notrace() clear_notrace()
screen = Screen.new(50, 9) screen = Screen.new(50, 9)
screen:attach()
bufnr = n.api.nvim_get_current_buf() bufnr = n.api.nvim_get_current_buf()
exec_lua(create_server_definition) exec_lua(create_server_definition)
@@ -339,7 +338,6 @@ test text
before_each(function() before_each(function()
clear_notrace() clear_notrace()
screen = Screen.new(50, 3) screen = Screen.new(50, 3)
screen:attach()
exec_lua(create_server_definition) exec_lua(create_server_definition)
bufnr = n.api.nvim_get_current_buf() 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 local screen --- @type test.functional.ui.screen
before_each(function() before_each(function()
screen = Screen.new(40, 16) screen = Screen.new(40, 16)
screen:attach()
screen:set_default_attr_ids { screen:set_default_attr_ids {
[1] = { bold = true, foreground = Screen.colors.Blue1 }, [1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { foreground = Screen.colors.DarkCyan }, [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)) eq(expected_anchor, string.sub(opts.anchor, 1, 1))
end end
local screen --- @type test.functional.ui.screen
before_each(function() before_each(function()
n.clear() n.clear()
screen = Screen.new(80, 80) local _ = Screen.new(80, 80)
screen:attach()
feed('79i<CR><Esc>') -- fill screen with empty lines feed('79i<CR><Esc>') -- fill screen with empty lines
end) end)

View File

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

View File

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

View File

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

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