123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089 |
- local helpers = require('test.functional.helpers')(after_each)
- local Screen = require('test.functional.ui.screen')
- local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear
- local feed, command = helpers.feed, helpers.command
- local insert = helpers.insert
- local eq = helpers.eq
- local eval = helpers.eval
- local iswin = helpers.iswin
- local funcs, meths, exec_lua = helpers.funcs, helpers.meths, helpers.exec_lua
- describe('screen', function()
- local screen
- local nvim_argv = {helpers.nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
- '--cmd', 'set shortmess+=I background=light noswapfile belloff= noshowcmd noruler',
- '--embed'}
- before_each(function()
- local screen_nvim = spawn(nvim_argv)
- set_session(screen_nvim)
- screen = Screen.new()
- screen:attach()
- screen:set_default_attr_ids( {
- [0] = {bold=true, foreground=255},
- [1] = {bold=true, reverse=true},
- } )
- end)
- it('default initial screen', function()
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {1:[No Name] }|
- |
- ]])
- end)
- end)
- local function screen_tests(linegrid)
- local screen
- before_each(function()
- clear()
- screen = Screen.new()
- screen:attach({rgb=true,ext_linegrid=linegrid})
- screen:set_default_attr_ids( {
- [0] = {bold=true, foreground=255},
- [1] = {bold=true, reverse=true},
- [2] = {bold=true},
- [3] = {reverse=true},
- [4] = {background = Screen.colors.LightGrey, underline = true},
- [5] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Fuchsia},
- [6] = {bold = true, foreground = Screen.colors.Fuchsia},
- [7] = {bold = true, foreground = Screen.colors.SeaGreen},
- } )
- end)
- describe(':suspend', function()
- it('is forwarded to the UI', function()
- local function check()
- eq(true, screen.suspended)
- end
- command('let g:ev = []')
- command('autocmd VimResume * :call add(g:ev, "r")')
- command('autocmd VimSuspend * :call add(g:ev, "s")')
- eq(false, screen.suspended)
- command('suspend')
- eq({ 's', 'r' }, eval('g:ev'))
- screen:expect(check)
- screen.suspended = false
- feed('<c-z>')
- eq({ 's', 'r', 's', 'r' }, eval('g:ev'))
- screen:expect(check)
- screen.suspended = false
- command('suspend')
- eq({ 's', 'r', 's', 'r', 's', 'r' }, eval('g:ev'))
- end)
- end)
- describe('bell/visual bell', function()
- it('is forwarded to the UI', function()
- feed('<left>')
- screen:expect(function()
- eq(true, screen.bell)
- eq(false, screen.visual_bell)
- end)
- screen.bell = false
- command('set visualbell')
- feed('<left>')
- screen:expect(function()
- eq(true, screen.visual_bell)
- eq(false, screen.bell)
- end)
- end)
- end)
- describe(':set title', function()
- it('is forwarded to the UI', function()
- local expected = 'test-title'
- command('set titlestring='..expected)
- command('set title')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
- it('has correct default title with unnamed file', function()
- local expected = '[No Name] - NVIM'
- command('set title')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
- it('has correct default title with named file', function()
- local expected = (iswin() and 'myfile (C:\\mydir) - NVIM' or 'myfile (/mydir) - NVIM')
- command('set title')
- command(iswin() and 'file C:\\mydir\\myfile' or 'file /mydir/myfile')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
- describe('is not changed by', function()
- local file1 = iswin() and 'C:\\mydir\\myfile1' or '/mydir/myfile1'
- local file2 = iswin() and 'C:\\mydir\\myfile2' or '/mydir/myfile2'
- local expected = (iswin() and 'myfile1 (C:\\mydir) - NVIM' or 'myfile1 (/mydir) - NVIM')
- local buf2
- before_each(function()
- command('edit '..file1)
- buf2 = funcs.bufadd(file2)
- command('set title')
- end)
- it('calling setbufvar() to set an option in a hidden buffer from i_CTRL-R', function()
- command([[inoremap <F2> <C-R>=setbufvar(]]..buf2..[[, '&autoindent', 1) ? '' : ''<CR>]])
- feed('i<F2><Esc>')
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
- it('an RPC call to nvim_buf_set_option in a hidden buffer', function()
- meths.buf_set_option(buf2, 'autoindent', true)
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
- it('a Lua callback calling nvim_buf_set_option in a hidden buffer', function()
- exec_lua(string.format([[
- vim.schedule(function()
- vim.api.nvim_buf_set_option(%d, 'autoindent', true)
- end)
- ]], buf2))
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
- it('a Lua callback calling nvim_buf_call in a hidden buffer', function()
- exec_lua(string.format([[
- vim.schedule(function()
- vim.api.nvim_buf_call(%d, function() end)
- end)
- ]], buf2))
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
- end)
- end)
- describe(':set icon', function()
- it('is forwarded to the UI', function()
- local expected = 'test-icon'
- command('set iconstring='..expected)
- command('set icon')
- screen:expect(function()
- eq(expected, screen.icon)
- end)
- end)
- end)
- describe('statusline', function()
- it('is redrawn after <c-l>', function()
- command('set laststatus=2')
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {1:[No Name] }|
- |
- ]])
- feed('<c-l>')
- screen:expect{grid=[[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {1:[No Name] }|
- |
- ]], reset=true}
- command('split')
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {1:[No Name] }|
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {3:[No Name] }|
- |
- ]])
- feed('<c-l>')
- screen:expect{grid=[[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {1:[No Name] }|
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {3:[No Name] }|
- |
- ]], reset=true}
- end)
- end)
- describe('window', function()
- describe('split', function()
- it('horizontal', function()
- command('sp')
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {1:[No Name] }|
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {3:[No Name] }|
- |
- ]])
- end)
- it('horizontal and resize', function()
- command('sp')
- command('resize 8')
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {1:[No Name] }|
- |
- {0:~ }|
- {0:~ }|
- {3:[No Name] }|
- |
- ]])
- end)
- it('horizontal and vertical', function()
- command('sp')
- command('vsp')
- command('vsp')
- screen:expect([[
- ^ {3:│} {3:│} |
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {1:[No Name] }{3:[No Name] [No Name] }|
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {3:[No Name] }|
- |
- ]])
- insert('hello')
- screen:expect([[
- hell^o {3:│}hello {3:│}hello |
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
- hello |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {3:[No Name] [+] }|
- |
- ]])
- end)
- end)
- end)
- describe('tabs', function()
- it('tabnew creates a new buffer', function()
- command('sp')
- command('vsp')
- command('vsp')
- insert('hello')
- screen:expect([[
- hell^o {3:│}hello {3:│}hello |
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
- hello |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {3:[No Name] [+] }|
- |
- ]])
- command('tabnew')
- insert('hello2')
- feed('h')
- screen:expect([[
- {4: }{5:4}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
- hell^o2 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]])
- command('tabprevious')
- screen:expect([[
- {2: }{6:4}{2:+ [No Name] }{4: + [No Name] }{3: }{4:X}|
- hell^o {3:│}hello {3:│}hello |
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
- {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
- hello |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {3:[No Name] [+] }|
- |
- ]])
- end)
- it('tabline is redrawn after messages', function()
- command('tabnew')
- screen:expect([[
- {4: [No Name] }{2: [No Name] }{3: }{4:X}|
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]])
- feed(':echo "'..string.rep('x\\n', 11)..'"<cr>')
- screen:expect([[
- {1: }|
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- |
- {7:Press ENTER or type command to continue}^ |
- ]])
- feed('<cr>')
- screen:expect([[
- {4: [No Name] }{2: [No Name] }{3: }{4:X}|
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]])
- feed(':echo "'..string.rep('x\\n', 12)..'"<cr>')
- screen:expect([[
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- x |
- |
- {7:Press ENTER or type command to continue}^ |
- ]])
- feed('<cr>')
- screen:expect([[
- {4: [No Name] }{2: [No Name] }{3: }{4:X}|
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]])
- end)
- it('redraws properly with :tab split right after scroll', function()
- feed('15Ofoo<esc>15Obar<esc>gg')
- command('vsplit')
- screen:expect([[
- ^foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- {1:[No Name] [+] }{3:[No Name] [+] }|
- |
- ]])
- feed('<PageDown>')
- screen:expect([[
- ^foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- bar {3:│}foo |
- bar {3:│}foo |
- bar {3:│}foo |
- bar {3:│}foo |
- bar {3:│}foo |
- bar {3:│}foo |
- bar {3:│}foo |
- bar {3:│}foo |
- {1:[No Name] [+] }{3:[No Name] [+] }|
- |
- ]])
- command('tab split')
- screen:expect([[
- {4: }{5:2}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
- ^foo |
- foo |
- foo |
- foo |
- bar |
- bar |
- bar |
- bar |
- bar |
- bar |
- bar |
- bar |
- |
- ]])
- end)
- it('redraws unvisited tab #9152', function()
- insert('hello')
- -- create a tab without visiting it
- command('tabnew|tabnext')
- screen:expect([[
- {2: + [No Name] }{4: [No Name] }{3: }{4:X}|
- hell^o |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]])
- feed('gT')
- screen:expect([[
- {4: + [No Name] }{2: [No Name] }{3: }{4:X}|
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]])
- end)
- end)
- describe('insert mode', function()
- it('move to next line with <cr>', function()
- feed('iline 1<cr>line 2<cr>')
- screen:expect([[
- line 1 |
- line 2 |
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {2:-- INSERT --} |
- ]])
- end)
- end)
- describe('normal mode', function()
- -- https://code.google.com/p/vim/issues/detail?id=339
- it("setting 'ruler' doesn't reset the preferred column", function()
- command('set virtualedit=')
- feed('i0123456<cr>789<esc>kllj')
- command('set ruler')
- feed('k')
- screen:expect([[
- 0123^456 |
- 789 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- 1,5 All |
- ]])
- end)
- end)
- describe('command mode', function()
- it('typing commands', function()
- feed(':ls')
- screen:expect([[
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- :ls^ |
- ]])
- end)
- it('execute command with multi-line output without msgsep', function()
- command("set display-=msgsep")
- feed(':ls<cr>')
- screen:expect([[
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- :ls |
- 1 %a "[No Name]" line 1 |
- {7:Press ENTER or type command to continue}^ |
- ]])
- feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
- end)
- it('execute command with multi-line output and with msgsep', function()
- command("set display+=msgsep")
- feed(':ls<cr>')
- screen:expect([[
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {1: }|
- :ls |
- 1 %a "[No Name]" line 1 |
- {7:Press ENTER or type command to continue}^ |
- ]])
- feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
- end)
- end)
- describe('scrolling and clearing', function()
- before_each(function()
- insert([[
- Inserting
- text
- with
- many
- lines
- to
- test
- scrolling
- and
- clearing
- in
- split
- windows
- ]])
- command('sp')
- command('vsp')
- command('vsp')
- screen:expect([[
- and {3:│}and {3:│}and |
- clearing {3:│}clearing {3:│}clearing |
- in {3:│}in {3:│}in |
- split {3:│}split {3:│}split |
- windows {3:│}windows {3:│}windows |
- ^ {3:│} {3:│} |
- {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
- clearing |
- in |
- split |
- windows |
- |
- {3:[No Name] [+] }|
- |
- ]])
- end)
- it('only affects the current scroll region', function()
- feed('6k')
- screen:expect([[
- ^scrolling {3:│}and {3:│}and |
- and {3:│}clearing {3:│}clearing |
- clearing {3:│}in {3:│}in |
- in {3:│}split {3:│}split |
- split {3:│}windows {3:│}windows |
- windows {3:│} {3:│} |
- {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
- clearing |
- in |
- split |
- windows |
- |
- {3:[No Name] [+] }|
- |
- ]])
- feed('<c-w>l')
- screen:expect([[
- scrolling {3:│}and {3:│}and |
- and {3:│}clearing {3:│}clearing |
- clearing {3:│}in {3:│}in |
- in {3:│}split {3:│}split |
- split {3:│}windows {3:│}windows |
- windows {3:│}^ {3:│} |
- {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
- clearing |
- in |
- split |
- windows |
- |
- {3:[No Name] [+] }|
- |
- ]])
- feed('gg')
- screen:expect([[
- scrolling {3:│}^Inserting {3:│}and |
- and {3:│}text {3:│}clearing |
- clearing {3:│}with {3:│}in |
- in {3:│}many {3:│}split |
- split {3:│}lines {3:│}windows |
- windows {3:│}to {3:│} |
- {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
- clearing |
- in |
- split |
- windows |
- |
- {3:[No Name] [+] }|
- |
- ]])
- feed('7j')
- screen:expect([[
- scrolling {3:│}with {3:│}and |
- and {3:│}many {3:│}clearing |
- clearing {3:│}lines {3:│}in |
- in {3:│}to {3:│}split |
- split {3:│}test {3:│}windows |
- windows {3:│}^scrolling {3:│} |
- {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
- clearing |
- in |
- split |
- windows |
- |
- {3:[No Name] [+] }|
- |
- ]])
- feed('2j')
- screen:expect([[
- scrolling {3:│}lines {3:│}and |
- and {3:│}to {3:│}clearing |
- clearing {3:│}test {3:│}in |
- in {3:│}scrolling {3:│}split |
- split {3:│}and {3:│}windows |
- windows {3:│}^clearing {3:│} |
- {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
- clearing |
- in |
- split |
- windows |
- |
- {3:[No Name] [+] }|
- |
- ]])
- feed('5k')
- screen:expect([[
- scrolling {3:│}^lines {3:│}and |
- and {3:│}to {3:│}clearing |
- clearing {3:│}test {3:│}in |
- in {3:│}scrolling {3:│}split |
- split {3:│}and {3:│}windows |
- windows {3:│}clearing {3:│} |
- {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
- clearing |
- in |
- split |
- windows |
- |
- {3:[No Name] [+] }|
- |
- ]])
- feed('k')
- screen:expect([[
- scrolling {3:│}^many {3:│}and |
- and {3:│}lines {3:│}clearing |
- clearing {3:│}to {3:│}in |
- in {3:│}test {3:│}split |
- split {3:│}scrolling {3:│}windows |
- windows {3:│}and {3:│} |
- {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
- clearing |
- in |
- split |
- windows |
- |
- {3:[No Name] [+] }|
- |
- ]])
- end)
- end)
- describe('resize', function()
- before_each(function()
- screen:try_resize(25, 5)
- feed('iresize')
- end)
- it('rebuilds the whole screen', function()
- screen:expect([[
- resize^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {2:-- INSERT --} |
- ]])
- end)
- it('has minimum width/height values', function()
- screen:try_resize(1, 1)
- screen:expect([[
- resize^ |
- {2:-- INSERT -} |
- ]])
- feed('<esc>:ls')
- screen:expect([[
- resize |
- :ls^ |
- ]])
- end)
- end)
- describe('press enter', function()
- it('does not crash on <F1> at “Press ENTER”', function()
- command('nnoremap <F1> :echo "TEST"<CR>')
- feed(':ls<CR>')
- screen:expect([[
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {1: }|
- :ls |
- 1 %a "[No Name]" line 1 |
- {7:Press ENTER or type command to continue}^ |
- ]])
- feed('<F1>')
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- TEST |
- ]])
- end)
- end)
- -- Regression test for #8357
- it('does not have artifacts after temporary chars in insert mode', function()
- command('set timeoutlen=10000')
- command('inoremap jk <esc>')
- feed('ifooj')
- screen:expect([[
- foo^j |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {2:-- INSERT --} |
- ]])
- feed('k')
- screen:expect([[
- fo^o |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]])
- end)
- end
- describe("Screen (char-based)", function()
- screen_tests(false)
- end)
- describe("Screen (line-based)", function()
- screen_tests(true)
- end)
- describe('Screen default colors', function()
- local screen
- local function startup(light, termcolors)
- local extra = (light and ' background=light') or ''
- local nvim_argv = {helpers.nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
- '--cmd', 'set shortmess+=I noswapfile belloff= noshowcmd noruler'..extra,
- '--embed'}
- local screen_nvim = spawn(nvim_argv)
- set_session(screen_nvim)
- screen = Screen.new()
- screen:attach(termcolors and {rgb=true,ext_termcolors=true} or {rgb=true})
- end
- it('are dark per default', function()
- startup(false, false)
- screen:expect{condition=function()
- eq({rgb_bg=0, rgb_fg=Screen.colors.White, rgb_sp=Screen.colors.Red,
- cterm_bg=0, cterm_fg=0}, screen.default_colors)
- end}
- end)
- it('can be set to light', function()
- startup(true, false)
- screen:expect{condition=function()
- eq({rgb_fg=Screen.colors.White, rgb_bg=0, rgb_sp=Screen.colors.Red,
- cterm_bg=0, cterm_fg=0}, screen.default_colors)
- end}
- end)
- it('can be handled by external terminal', function()
- startup(false, true)
- screen:expect{condition=function()
- eq({rgb_bg=-1, rgb_fg=-1, rgb_sp=-1, cterm_bg=0, cterm_fg=0}, screen.default_colors)
- end}
- startup(true, true)
- screen:expect{condition=function()
- eq({rgb_bg=-1, rgb_fg=-1, rgb_sp=-1, cterm_bg=0, cterm_fg=0}, screen.default_colors)
- end}
- end)
- end)
- describe('screen with msgsep deactivated on startup', function()
- local screen
- before_each(function()
- clear('--cmd', 'set display-=msgsep')
- screen = Screen.new()
- screen:attach()
- screen:set_default_attr_ids {
- [0] = {bold=true, foreground=255};
- [7] = {bold = true, foreground = Screen.colors.SeaGreen};
- }
- end)
- it('execute command with multi-line output', function()
- feed ':ls<cr>'
- screen:expect([[
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- :ls |
- 1 %a "[No Name]" line 1 |
- {7:Press ENTER or type command to continue}^ |
- ]])
- feed '<cr>' -- skip the "Press ENTER..." state or tests will hang
- end)
- end)
|