2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2014-12-08 18:31:45 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2015-06-20 14:45:03 -07:00
|
|
|
local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear
|
2017-04-08 14:12:26 -07:00
|
|
|
local feed, command = helpers.feed, helpers.command
|
2015-11-17 14:44:00 -07:00
|
|
|
local insert = helpers.insert
|
2016-11-25 03:33:57 -07:00
|
|
|
local eq = helpers.eq
|
2017-01-18 12:28:35 -07:00
|
|
|
local eval = helpers.eval
|
2017-09-18 11:06:55 -07:00
|
|
|
local iswin = helpers.iswin
|
2016-08-15 16:42:12 -07:00
|
|
|
|
2017-04-24 17:17:15 -07:00
|
|
|
describe('screen', function()
|
2015-06-20 14:45:03 -07:00
|
|
|
local screen
|
|
|
|
local nvim_argv = {helpers.nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
|
2017-02-09 19:39:00 -07:00
|
|
|
'--cmd', 'set shortmess+=I background=light noswapfile belloff= noshowcmd noruler',
|
2015-06-20 14:45:03 -07:00
|
|
|
'--embed'}
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
local screen_nvim = spawn(nvim_argv)
|
|
|
|
set_session(screen_nvim)
|
|
|
|
screen = Screen.new()
|
|
|
|
screen:attach()
|
2016-08-09 06:04:43 -07:00
|
|
|
screen:set_default_attr_ids( {
|
|
|
|
[0] = {bold=true, foreground=255},
|
|
|
|
[1] = {bold=true, reverse=true},
|
|
|
|
} )
|
2015-06-20 14:45:03 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
after_each(function()
|
|
|
|
screen:detach()
|
|
|
|
end)
|
|
|
|
|
2017-04-24 17:17:15 -07:00
|
|
|
it('default initial screen', function()
|
2015-06-20 14:45:03 -07:00
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{1:[No Name] }|
|
2015-06-20 14:45:03 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2014-12-08 18:31:45 -07:00
|
|
|
describe('Screen', function()
|
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = Screen.new()
|
|
|
|
screen:attach()
|
2016-08-09 06:04:43 -07:00
|
|
|
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},
|
|
|
|
} )
|
2014-12-08 18:31:45 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
after_each(function()
|
|
|
|
screen:detach()
|
|
|
|
end)
|
|
|
|
|
2015-01-15 05:01:25 -07:00
|
|
|
describe(':suspend', function()
|
|
|
|
it('is forwarded to the UI', function()
|
|
|
|
local function check()
|
2017-04-04 08:47:23 -07:00
|
|
|
eq(true, screen.suspended)
|
2015-01-15 05:01:25 -07:00
|
|
|
end
|
2017-04-08 14:12:26 -07:00
|
|
|
command('suspend')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(check)
|
2015-01-15 05:01:25 -07:00
|
|
|
screen.suspended = false
|
|
|
|
feed('<c-z>')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(check)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('bell/visual bell', function()
|
|
|
|
it('is forwarded to the UI', function()
|
|
|
|
feed('<left>')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(true, screen.bell)
|
|
|
|
eq(false, screen.visual_bell)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
|
|
|
screen.bell = false
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set visualbell')
|
2015-01-15 05:01:25 -07:00
|
|
|
feed('<left>')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(true, screen.visual_bell)
|
|
|
|
eq(false, screen.bell)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe(':set title', function()
|
|
|
|
it('is forwarded to the UI', function()
|
|
|
|
local expected = 'test-title'
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set titlestring='..expected)
|
|
|
|
command('set title')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(expected, screen.title)
|
2015-07-23 12:07:51 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('has correct default title with unnamed file', function()
|
|
|
|
local expected = '[No Name] - NVIM'
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set title')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(expected, screen.title)
|
2015-07-23 12:07:51 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('has correct default title with named file', function()
|
2017-10-01 15:24:19 -07:00
|
|
|
local expected = (iswin() and 'myfile (C:\\mydir) - NVIM'
|
|
|
|
or 'myfile (/mydir) - NVIM')
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set title')
|
2017-10-01 15:24:19 -07:00
|
|
|
command(iswin() and 'file C:\\mydir\\myfile' or 'file /mydir/myfile')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(expected, screen.title)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe(':set icon', function()
|
|
|
|
it('is forwarded to the UI', function()
|
|
|
|
local expected = 'test-icon'
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set iconstring='..expected)
|
|
|
|
command('set icon')
|
2017-04-04 08:47:23 -07:00
|
|
|
screen:expect(function()
|
|
|
|
eq(expected, screen.icon)
|
2015-01-15 05:01:25 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2014-12-08 18:31:45 -07:00
|
|
|
describe('window', function()
|
|
|
|
describe('split', function()
|
|
|
|
it('horizontal', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
2014-12-08 18:31:45 -07:00
|
|
|
screen:expect([[
|
2015-03-05 02:07:55 -07:00
|
|
|
^ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{1:[No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{3:[No Name] }|
|
2017-04-08 17:02:52 -07:00
|
|
|
|
|
2014-12-08 18:31:45 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('horizontal and resize', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
|
|
|
command('resize 8')
|
2014-12-08 18:31:45 -07:00
|
|
|
screen:expect([[
|
2015-03-05 02:07:55 -07:00
|
|
|
^ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{1:[No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{3:[No Name] }|
|
2017-04-08 17:02:52 -07:00
|
|
|
|
|
2014-12-08 18:31:45 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('horizontal and vertical', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
|
|
|
command('vsp')
|
|
|
|
command('vsp')
|
2014-12-08 18:31:45 -07:00
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
^ {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:~ }|
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] }{3:[No Name] [No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{3:[No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
insert('hello')
|
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
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:~ }|
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
hello |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{3:[No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('tabnew', function()
|
|
|
|
it('creates a new buffer', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
|
|
|
command('vsp')
|
|
|
|
command('vsp')
|
2014-12-08 18:31:45 -07:00
|
|
|
insert('hello')
|
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
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:~ }|
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
hello |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{3:[No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
command('tabnew')
|
2014-12-08 18:31:45 -07:00
|
|
|
insert('hello2')
|
|
|
|
feed('h')
|
|
|
|
screen:expect([[
|
2016-08-09 06:04:43 -07:00
|
|
|
{4: }{5:4}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
|
2015-03-05 02:07:55 -07:00
|
|
|
hell^o2 |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
command('tabprevious')
|
2014-12-08 18:31:45 -07:00
|
|
|
screen:expect([[
|
2016-08-09 06:04:43 -07:00
|
|
|
{2: }{6:4}{2:+ [No Name] }{4: + [No Name] }{3: }{4:X}|
|
2018-02-08 16:44:24 -07:00
|
|
|
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:~ }|
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
hello |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{3:[No Name] [+] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
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 |
|
2015-03-05 02:07:55 -07:00
|
|
|
^ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{2:-- INSERT --} |
|
2014-12-08 18:31:45 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2015-04-27 19:08:14 -07:00
|
|
|
describe('normal mode', function()
|
|
|
|
-- https://code.google.com/p/vim/issues/detail?id=339
|
|
|
|
it("setting 'ruler' doesn't reset the preferred column", function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set virtualedit=')
|
2015-04-27 19:08:14 -07:00
|
|
|
feed('i0123456<cr>789<esc>kllj')
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set ruler')
|
2015-04-27 19:08:14 -07:00
|
|
|
feed('k')
|
|
|
|
screen:expect([[
|
|
|
|
0123^456 |
|
|
|
|
789 |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
2017-04-08 17:02:52 -07:00
|
|
|
1,5 All |
|
2015-04-27 19:08:14 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2014-12-08 18:31:45 -07:00
|
|
|
describe('command mode', function()
|
|
|
|
it('typing commands', function()
|
|
|
|
feed(':ls')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
2015-03-05 02:07:55 -07:00
|
|
|
:ls^ |
|
2014-12-08 18:31:45 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('execute command with multi-line output', function()
|
|
|
|
feed(':ls<cr>')
|
|
|
|
screen:expect([[
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
2014-12-08 18:31:45 -07:00
|
|
|
:ls |
|
|
|
|
1 %a "[No Name]" line 1 |
|
2016-08-09 06:04:43 -07:00
|
|
|
{7:Press ENTER or type command to continue}^ |
|
2014-12-08 18:31:45 -07:00
|
|
|
]])
|
|
|
|
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
|
|
|
|
end)
|
|
|
|
end)
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
describe('scrolling and clearing', function()
|
|
|
|
before_each(function()
|
|
|
|
insert([[
|
|
|
|
Inserting
|
|
|
|
text
|
|
|
|
with
|
|
|
|
many
|
|
|
|
lines
|
|
|
|
to
|
|
|
|
test
|
|
|
|
scrolling
|
|
|
|
and
|
|
|
|
clearing
|
|
|
|
in
|
|
|
|
split
|
|
|
|
windows
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
command('sp')
|
|
|
|
command('vsp')
|
|
|
|
command('vsp')
|
2015-01-15 05:01:25 -07:00
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
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:│} |
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('only affects the current scroll region', function()
|
|
|
|
feed('6k')
|
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
^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:│} |
|
2016-08-09 06:04:43 -07:00
|
|
|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('<c-w>l')
|
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
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:│} |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('gg')
|
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
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:│} |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('7j')
|
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
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:│} |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('2j')
|
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
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:│} |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('5k')
|
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
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:│} |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('k')
|
|
|
|
screen:expect([[
|
2018-02-08 16:44:24 -07:00
|
|
|
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:│} |
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
clearing |
|
|
|
|
in |
|
|
|
|
split |
|
|
|
|
windows |
|
|
|
|
|
|
2016-08-09 06:04:43 -07:00
|
|
|
{3:[No Name] [+] }|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('resize', function()
|
|
|
|
before_each(function()
|
|
|
|
screen:try_resize(25, 5)
|
|
|
|
feed('iresize')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('rebuilds the whole screen', function()
|
|
|
|
screen:expect([[
|
2015-03-05 02:07:55 -07:00
|
|
|
resize^ |
|
2016-08-09 06:04:43 -07:00
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{2:-- INSERT --} |
|
2015-01-15 05:01:25 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2017-01-18 05:53:10 -07:00
|
|
|
it('has minimum width/height values', function()
|
2015-01-15 05:01:25 -07:00
|
|
|
screen:try_resize(1, 1)
|
|
|
|
screen:expect([[
|
2017-01-18 05:53:10 -07:00
|
|
|
{2:-- INS^ERT --}|
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('<esc>:ls')
|
|
|
|
screen:expect([[
|
|
|
|
resize |
|
2015-03-05 02:07:55 -07:00
|
|
|
:ls^ |
|
2015-01-15 05:01:25 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
2017-05-09 04:31:19 -07:00
|
|
|
|
|
|
|
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:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
{0:~ }|
|
|
|
|
: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)
|
2017-04-24 17:17:15 -07:00
|
|
|
end)
|
2016-11-25 03:33:57 -07:00
|
|
|
|
2017-04-24 17:17:15 -07:00
|
|
|
describe('nvim_ui_attach()', function()
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
end)
|
|
|
|
it('handles very large width/height #2180', function()
|
|
|
|
local screen = Screen.new(999, 999)
|
2017-01-18 12:28:35 -07:00
|
|
|
screen:attach()
|
|
|
|
eq(999, eval('&lines'))
|
|
|
|
eq(999, eval('&columns'))
|
|
|
|
end)
|
2017-04-25 01:14:29 -07:00
|
|
|
it('invalid option returns error', function()
|
2017-04-24 17:17:15 -07:00
|
|
|
local screen = Screen.new()
|
2017-04-25 01:14:29 -07:00
|
|
|
local status, rv = pcall(function() screen:attach({foo={'foo'}}) end)
|
2017-04-24 17:17:15 -07:00
|
|
|
eq(false, status)
|
2017-04-25 01:14:29 -07:00
|
|
|
eq('No such ui option', rv:match("No such .*"))
|
2017-04-24 17:17:15 -07:00
|
|
|
end)
|
2014-12-08 18:31:45 -07:00
|
|
|
end)
|