aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/screen_basic_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui/screen_basic_spec.lua')
-rw-r--r--test/functional/ui/screen_basic_spec.lua961
1 files changed, 679 insertions, 282 deletions
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 9249be4aec..04d532f6e1 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -1,13 +1,16 @@
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, execute = helpers.feed, helpers.execute
+local feed, command = helpers.feed, helpers.command
local insert = helpers.insert
+local eq = helpers.eq
+local eval = helpers.eval
+local iswin = helpers.iswin
-describe('Initial screen', function()
+describe('screen', function()
local screen
local nvim_argv = {helpers.nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
- '--cmd', 'set shortmess+=I background=light noswapfile',
+ '--cmd', 'set shortmess+=I background=light noswapfile belloff= noshowcmd noruler',
'--embed'}
before_each(function()
@@ -15,41 +18,53 @@ describe('Initial screen', function()
set_session(screen_nvim)
screen = Screen.new()
screen:attach()
- screen:set_default_attr_ignore( {{bold=true, foreground=255}} )
+ screen:set_default_attr_ids( {
+ [0] = {bold=true, foreground=255},
+ [1] = {bold=true, reverse=true},
+ } )
end)
after_each(function()
screen:detach()
end)
- it('is the default initial screen', function()
+ it('default initial screen', function()
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- [No Name] |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
|
]])
end)
end)
-describe('Screen', function()
+local function screen_tests(linegrid)
local screen
before_each(function()
clear()
screen = Screen.new()
- screen:attach()
- screen:set_default_attr_ignore( {{bold=true, foreground=255}} )
+ 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)
after_each(function()
@@ -59,33 +74,44 @@ describe('Screen', function()
describe(':suspend', function()
it('is forwarded to the UI', function()
local function check()
- if not screen.suspended then
- return 'Screen was not suspended'
- end
+ eq(true, screen.suspended)
end
- execute('suspend')
- screen:wait(check)
+
+ 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>')
- screen:wait(check)
+ 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:wait(function()
- if not screen.bell or screen.visual_bell then
- return 'Bell was not sent'
- end
+ screen:expect(function()
+ eq(true, screen.bell)
+ eq(false, screen.visual_bell)
end)
screen.bell = false
- execute('set visualbell')
+ command('set visualbell')
feed('<left>')
- screen:wait(function()
- if not screen.visual_bell or screen.bell then
- return 'Visual bell was not sent'
- end
+ screen:expect(function()
+ eq(true, screen.visual_bell)
+ eq(false, screen.bell)
end)
end)
end)
@@ -93,36 +119,28 @@ describe('Screen', function()
describe(':set title', function()
it('is forwarded to the UI', function()
local expected = 'test-title'
- execute('set titlestring='..expected)
- execute('set title')
- screen:wait(function()
- local actual = screen.title
- if actual ~= expected then
- return 'Expected title to be "'..expected..'" but was "'..actual..'"'
- end
+ 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'
- execute('set title')
- screen:wait(function()
- local actual = screen.title
- if actual ~= expected then
- return 'Expected title to be "'..expected..'" but was "'..actual..'"'
- end
+ command('set title')
+ screen:expect(function()
+ eq(expected, screen.title)
end)
end)
it('has correct default title with named file', function()
- local expected = 'myfile (/mydir) - NVIM'
- execute('set title')
- execute('file /mydir/myfile')
- screen:wait(function()
- local actual = screen.title
- if actual ~= expected then
- return 'Expected title to be "'..expected..'" but was "'..actual..'"'
- end
+ 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)
end)
@@ -130,153 +148,420 @@ describe('Screen', function()
describe(':set icon', function()
it('is forwarded to the UI', function()
local expected = 'test-icon'
- execute('set iconstring='..expected)
- execute('set icon')
- screen:wait(function()
- local actual = screen.icon
- if actual ~= expected then
- return 'Expected title to be "'..expected..'" but was "'..actual..'"'
- end
+ 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()
- execute('sp')
+ command('sp')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- [No Name] |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] }|
|
- ~ |
- ~ |
- ~ |
- ~ |
- [No Name] |
- :sp |
]])
end)
it('horizontal and resize', function()
- execute('sp')
- execute('resize 8')
+ command('sp')
+ command('resize 8')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- [No Name] |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
+ |
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] }|
|
- ~ |
- ~ |
- [No Name] |
- :resize 8 |
]])
end)
it('horizontal and vertical', function()
- execute('sp', 'vsp', 'vsp')
+ command('sp')
+ command('vsp')
+ command('vsp')
screen:expect([[
- ^ | | |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- [No Name] [No Name] [No Name] |
+ ^ {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] }|
|
- ~ |
- ~ |
- ~ |
- ~ |
- [No Name] |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] }|
|
]])
insert('hello')
screen:expect([[
- hell^o |hello |hello |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- [No Name] [+] [No Name] [+] [No Name] [+] |
+ 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 |
- ~ |
- ~ |
- ~ |
- ~ |
- [No Name] [+] |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] [+] }|
|
]])
end)
end)
end)
- describe('tabnew', function()
- it('creates a new buffer', function()
- execute('sp', 'vsp', 'vsp')
+ describe('tabs', function()
+ it('tabnew creates a new buffer', function()
+ command('sp')
+ command('vsp')
+ command('vsp')
insert('hello')
screen:expect([[
- hell^o |hello |hello |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- [No Name] [+] [No Name] [+] [No Name] [+] |
+ 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 |
- ~ |
- ~ |
- ~ |
- ~ |
- [No Name] [+] |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] [+] }|
|
]])
- execute('tabnew')
+ command('tabnew')
insert('hello2')
feed('h')
screen:expect([[
- 4+ [No Name] + [No Name] X|
+ {4: }{5:4}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
hell^o2 |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- |
- ]])
- execute('tabprevious')
- screen:expect([[
- 4+ [No Name] + [No Name] X|
- hell^o |hello |hello |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- ~ |~ |~ |
- [No Name] [+] [No Name] [+] [No Name] [+] |
+ {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 |
- ~ |
- ~ |
- ~ |
- [No Name] [+] |
+ {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)
@@ -289,17 +574,17 @@ describe('Screen', function()
line 1 |
line 2 |
^ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- -- INSERT -- |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT --} |
]])
end)
end)
@@ -307,25 +592,25 @@ describe('Screen', function()
describe('normal mode', function()
-- https://code.google.com/p/vim/issues/detail?id=339
it("setting 'ruler' doesn't reset the preferred column", function()
- execute('set virtualedit=')
+ command('set virtualedit=')
feed('i0123456<cr>789<esc>kllj')
- execute('set ruler')
+ command('set ruler')
feed('k')
screen:expect([[
0123^456 |
789 |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- :set ruler 1,5 All |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ 1,5 All |
]])
end)
end)
@@ -335,39 +620,62 @@ describe('Screen', 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', function()
+ 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 |
- Press ENTER or type command to continue^ |
+ {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)
@@ -390,21 +698,23 @@ describe('Screen', function()
split
windows
]])
- execute('sp', 'vsp', 'vsp')
+ command('sp')
+ command('vsp')
+ command('vsp')
screen:expect([[
- and |and |and |
- clearing |clearing |clearing |
- in |in |in |
- split |split |split |
- windows |windows |windows |
- ^ | | |
- [No Name] [+] [No Name] [+] [No Name] [+] |
+ 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 |
|
- [No Name] [+] |
+ {3:[No Name] [+] }|
|
]])
end)
@@ -412,121 +722,121 @@ describe('Screen', function()
it('only affects the current scroll region', function()
feed('6k')
screen:expect([[
- ^scrolling |and |and |
- and |clearing |clearing |
- clearing |in |in |
- in |split |split |
- split |windows |windows |
- windows | | |
- [No Name] [+] [No Name] [+] [No Name] [+] |
+ ^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 |
|
- [No Name] [+] |
+ {3:[No Name] [+] }|
|
]])
feed('<c-w>l')
screen:expect([[
- scrolling |and |and |
- and |clearing |clearing |
- clearing |in |in |
- in |split |split |
- split |windows |windows |
- windows |^ | |
- [No Name] [+] [No Name] [+] <Name] [+] |
+ 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 |
|
- [No Name] [+] |
+ {3:[No Name] [+] }|
|
]])
feed('gg')
screen:expect([[
- scrolling |^Inserting |and |
- and |text |clearing |
- clearing |with |in |
- in |many |split |
- split |lines |windows |
- windows |to | |
- [No Name] [+] [No Name] [+] <Name] [+] |
+ 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 |
|
- [No Name] [+] |
+ {3:[No Name] [+] }|
|
]])
feed('7j')
screen:expect([[
- scrolling |with |and |
- and |many |clearing |
- clearing |lines |in |
- in |to |split |
- split |test |windows |
- windows |^scrolling | |
- [No Name] [+] [No Name] [+] <Name] [+] |
+ 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 |
|
- [No Name] [+] |
+ {3:[No Name] [+] }|
|
]])
feed('2j')
screen:expect([[
- scrolling |lines |and |
- and |to |clearing |
- clearing |test |in |
- in |scrolling |split |
- split |and |windows |
- windows |^clearing | |
- [No Name] [+] [No Name] [+] <Name] [+] |
+ 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 |
|
- [No Name] [+] |
+ {3:[No Name] [+] }|
|
]])
feed('5k')
screen:expect([[
- scrolling |^lines |and |
- and |to |clearing |
- clearing |test |in |
- in |scrolling |split |
- split |and |windows |
- windows |clearing | |
- [No Name] [+] [No Name] [+] <Name] [+] |
+ 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 |
|
- [No Name] [+] |
+ {3:[No Name] [+] }|
|
]])
feed('k')
screen:expect([[
- scrolling |^many |and |
- and |lines |clearing |
- clearing |to |in |
- in |test |split |
- split |scrolling |windows |
- windows |and | |
- [No Name] [+] [No Name] [+] <Name] [+] |
+ 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 |
|
- [No Name] [+] |
+ {3:[No Name] [+] }|
|
]])
end)
@@ -541,20 +851,20 @@ describe('Screen', function()
it('rebuilds the whole screen', function()
screen:expect([[
resize^ |
- ~ |
- ~ |
- ~ |
- -- INSERT -- |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT --} |
]])
end)
- -- FIXME this has some race conditions that cause it to fail periodically
- pending('has minimum width/height values', function()
+ it('has minimum width/height values', function()
screen:try_resize(1, 1)
screen:expect([[
- -- INS^ERT --|
- |
+ resize^ |
+ {2:-- INSERT -} |
]])
+
feed('<esc>:ls')
screen:expect([[
resize |
@@ -562,4 +872,91 @@ describe('Screen', function()
]])
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('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)