mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
65fb622000
Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed.
101 lines
4.4 KiB
Lua
101 lines
4.4 KiB
Lua
local helpers = require('test.functional.helpers')(after_each)
|
|
local thelpers = require('test.functional.terminal.helpers')
|
|
local clear = helpers.clear
|
|
local feed, nvim = helpers.feed, helpers.nvim
|
|
local feed_command = helpers.feed_command
|
|
|
|
if helpers.pending_win32(pending) then return end
|
|
|
|
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)
|
|
|
|
it('resets its size when entering terminal window', function()
|
|
feed('<c-\\><c-n>')
|
|
feed_command('2split')
|
|
screen:expect([[
|
|
rows: 2, cols: 50 |
|
|
{2:^ } |
|
|
========== |
|
|
rows: 2, cols: 50 |
|
|
{2: } |
|
|
{4:~ }|
|
|
{4:~ }|
|
|
{4:~ }|
|
|
========== |
|
|
:2split |
|
|
]])
|
|
feed_command('wincmd p')
|
|
screen:expect([[
|
|
tty ready |
|
|
rows: 2, cols: 50 |
|
|
========== |
|
|
tty ready |
|
|
rows: 2, cols: 50 |
|
|
rows: 5, cols: 50 |
|
|
{2: } |
|
|
^ |
|
|
========== |
|
|
:wincmd p |
|
|
]])
|
|
feed_command('wincmd p')
|
|
screen:expect([[
|
|
rows: 2, cols: 50 |
|
|
{2:^ } |
|
|
========== |
|
|
rows: 2, cols: 50 |
|
|
{2: } |
|
|
{4:~ }|
|
|
{4:~ }|
|
|
{4:~ }|
|
|
========== |
|
|
:wincmd p |
|
|
]])
|
|
end)
|
|
|
|
describe('when the screen is resized', function()
|
|
it('will forward a resize request to the program', function()
|
|
screen:try_resize(screen._width + 3, screen._height + 5)
|
|
screen:expect([[
|
|
tty ready |
|
|
rows: 14, cols: 53 |
|
|
{1: } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{3:-- TERMINAL --} |
|
|
]])
|
|
screen:try_resize(screen._width - 6, screen._height - 10)
|
|
screen:expect([[
|
|
tty ready |
|
|
rows: 14, cols: 53 |
|
|
rows: 4, cols: 47 |
|
|
{1: } |
|
|
{3:-- TERMINAL --} |
|
|
]])
|
|
end)
|
|
end)
|
|
end)
|