2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2015-03-25 05:14:47 -07:00
|
|
|
local thelpers = require('test.functional.terminal.helpers')
|
2015-11-17 14:44:00 -07:00
|
|
|
local clear = helpers.clear
|
2015-03-25 05:14:47 -07:00
|
|
|
local feed, nvim = helpers.feed, helpers.nvim
|
2017-04-08 14:12:26 -07:00
|
|
|
local feed_command = helpers.feed_command
|
2015-03-25 05:14:47 -07:00
|
|
|
|
|
|
|
describe('terminal', function()
|
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
-- set the statusline to a constant value because of variables like pid
|
|
|
|
-- and current directory and to improve visibility of splits
|
|
|
|
nvim('set_option', 'statusline', '==========')
|
|
|
|
nvim('command', 'highlight StatusLine cterm=NONE')
|
|
|
|
nvim('command', 'highlight StatusLineNC cterm=NONE')
|
|
|
|
nvim('command', 'highlight VertSplit cterm=NONE')
|
|
|
|
screen = thelpers.screen_setup(3)
|
|
|
|
end)
|
|
|
|
|
|
|
|
after_each(function()
|
|
|
|
screen:detach()
|
|
|
|
end)
|
|
|
|
|
2016-06-20 11:47:23 -07:00
|
|
|
it('resets its size when entering terminal window', function()
|
2017-08-07 17:26:25 -07:00
|
|
|
if helpers.pending_win32(pending) then return end
|
2016-06-20 11:47:23 -07:00
|
|
|
feed('<c-\\><c-n>')
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command('2split')
|
2016-06-20 11:47:23 -07:00
|
|
|
screen:expect([[
|
2017-02-22 05:14:54 -07:00
|
|
|
rows: 2, cols: 50 |
|
|
|
|
{2:^ } |
|
2016-06-20 11:47:23 -07:00
|
|
|
========== |
|
|
|
|
rows: 2, cols: 50 |
|
|
|
|
{2: } |
|
2016-08-09 08:01:56 -07:00
|
|
|
{4:~ }|
|
|
|
|
{4:~ }|
|
2017-02-22 05:14:54 -07:00
|
|
|
{4:~ }|
|
2016-06-20 11:47:23 -07:00
|
|
|
========== |
|
2017-02-26 02:21:44 -07:00
|
|
|
:2split |
|
2016-06-20 11:47:23 -07:00
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command('wincmd p')
|
2016-06-20 11:47:23 -07:00
|
|
|
screen:expect([[
|
|
|
|
tty ready |
|
|
|
|
rows: 2, cols: 50 |
|
|
|
|
========== |
|
|
|
|
tty ready |
|
|
|
|
rows: 2, cols: 50 |
|
|
|
|
rows: 5, cols: 50 |
|
|
|
|
{2: } |
|
|
|
|
^ |
|
|
|
|
========== |
|
|
|
|
:wincmd p |
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command('wincmd p')
|
2016-06-20 11:47:23 -07:00
|
|
|
screen:expect([[
|
2017-02-22 05:14:54 -07:00
|
|
|
rows: 2, cols: 50 |
|
|
|
|
{2:^ } |
|
2016-06-20 11:47:23 -07:00
|
|
|
========== |
|
|
|
|
rows: 2, cols: 50 |
|
|
|
|
{2: } |
|
2016-08-09 08:01:56 -07:00
|
|
|
{4:~ }|
|
|
|
|
{4:~ }|
|
2017-02-22 05:14:54 -07:00
|
|
|
{4:~ }|
|
2016-06-20 11:47:23 -07:00
|
|
|
========== |
|
|
|
|
:wincmd p |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2015-03-25 05:14:47 -07:00
|
|
|
describe('when the screen is resized', function()
|
|
|
|
it('will forward a resize request to the program', function()
|
2017-08-07 17:26:25 -07:00
|
|
|
feed([[<C-\><C-N>:]]) -- Go to cmdline-mode, so cursor is at bottom.
|
|
|
|
screen:try_resize(screen._width - 3, screen._height - 2)
|
2015-03-25 05:14:47 -07:00
|
|
|
screen:expect([[
|
2017-08-07 17:26:25 -07:00
|
|
|
tty ready |
|
|
|
|
rows: 7, cols: 47 |
|
|
|
|
{2: } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:^ |
|
2015-03-25 05:14:47 -07:00
|
|
|
]])
|
2017-08-07 17:26:25 -07:00
|
|
|
screen:try_resize(screen._width - 6, screen._height - 3)
|
2015-03-25 05:14:47 -07:00
|
|
|
screen:expect([[
|
2017-08-07 17:26:25 -07:00
|
|
|
tty ready |
|
|
|
|
rows: 7, cols: 47 |
|
|
|
|
rows: 4, cols: 41 |
|
|
|
|
{2: } |
|
|
|
|
:^ |
|
2015-03-25 05:14:47 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|