neovim/test/functional/ui/multigrid_spec.lua

1860 lines
91 KiB
Lua
Raw Normal View History

2018-12-18 04:50:44 -07:00
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
2018-12-23 10:37:45 -07:00
local clear = helpers.clear
2018-12-18 04:50:44 -07:00
local feed, command, insert = helpers.feed, helpers.command, helpers.insert
local eq = helpers.eq
2019-01-01 04:46:47 -07:00
local meths = helpers.meths
local wait = helpers.wait
2018-12-18 04:50:44 -07:00
2019-01-01 04:46:47 -07:00
describe('ext_multigrid', function()
2018-12-18 04:50:44 -07:00
local screen
before_each(function()
clear{args_rm={'--headless'}, args={'--cmd', 'set laststatus=2'}}
2018-12-23 10:37:45 -07:00
screen = Screen.new(53,14)
2018-12-18 04:50:44 -07:00
screen:attach({ext_multigrid=true})
screen:set_default_attr_ids({
[1] = {bold = true, foreground = Screen.colors.Blue1},
[2] = {foreground = Screen.colors.Magenta},
[3] = {foreground = Screen.colors.Brown, bold = true},
[4] = {foreground = Screen.colors.SlateBlue},
[5] = {bold = true, foreground = Screen.colors.SlateBlue},
[6] = {foreground = Screen.colors.Cyan4},
[7] = {bold = true},
[8] = {underline = true, bold = true, foreground = Screen.colors.SlateBlue},
[9] = {foreground = Screen.colors.SlateBlue, underline = true},
[10] = {foreground = Screen.colors.Red},
[11] = {bold = true, reverse = true},
[12] = {reverse = true},
[13] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey},
[14] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
[15] = {bold = true, foreground = Screen.colors.SeaGreen4},
[16] = {background = Screen.colors.LightGrey, underline = true},
[17] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Magenta},
[18] = {bold = true, foreground = Screen.colors.Magenta},
[19] = {foreground = Screen.colors.Brown},
2018-12-18 04:50:44 -07:00
})
end)
after_each(function()
screen:detach()
end)
it('default initial screen', function()
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
|
## grid 2
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('positions windows correctly', function()
command('vsplit')
screen:expect{grid=[[
2018-12-18 04:50:44 -07:00
## grid 1
2018-11-17 10:23:42 -07:00
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]], condition=function()
2018-12-18 04:50:44 -07:00
eq({
[2] = { win = {id=1000}, startrow = 0, startcol = 27, width = 26, height = 12 },
[3] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 }
2018-12-18 04:50:44 -07:00
}, screen.win_position)
end}
2018-12-18 04:50:44 -07:00
command('wincmd l')
command('split')
screen:expect{grid=[[
2018-12-18 04:50:44 -07:00
## grid 1
2018-11-17 10:23:42 -07:00
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}[4:--------------------------]|
[3:--------------------------]{12:│}{11:[No Name] }|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
2018-12-18 04:50:44 -07:00
{12:[No Name] [No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]], condition=function()
2018-12-18 04:50:44 -07:00
eq({
[2] = { win = {id=1000}, startrow = 7, startcol = 27, width = 26, height = 5 },
[3] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 },
[4] = { win = {id=1002}, startrow = 0, startcol = 27, width = 26, height = 6 }
2018-12-18 04:50:44 -07:00
}, screen.win_position)
end}
2018-12-18 04:50:44 -07:00
command('wincmd h')
command('q')
screen:expect{grid=[[
2018-12-18 04:50:44 -07:00
## grid 1
2018-11-17 10:23:42 -07:00
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]], condition=function()
2018-12-18 04:50:44 -07:00
eq({
[2] = { win = {id=1000}, startrow = 7, startcol = 0, width = 53, height = 5 },
[4] = { win = {id=1002}, startrow = 0, startcol = 0, width = 53, height = 6 }
2018-12-18 04:50:44 -07:00
}, screen.win_position)
end}
2018-12-18 04:50:44 -07:00
end)
describe('split', function ()
describe('horizontally', function ()
it('allocates grids', function ()
command('sp')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('resizes grids', function ()
command('sp')
command('resize 8')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('splits vertically', function()
command('sp')
command('vsp')
command('vsp')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }{12:[No Name] [No Name] }|
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 5
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
insert('hello')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
[5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] [+] }{12:[No Name] [+] [No Name] [+] }|
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{12:[No Name] [+] }|
|
## grid 2
hello |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
hello |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
hello |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 5
hell^o |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('closes splits', function ()
command('sp')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
2018-12-18 04:50:44 -07:00
|
2018-11-17 10:23:42 -07:00
## grid 2
2018-12-18 04:50:44 -07:00
|
2018-11-17 10:23:42 -07:00
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
command('q')
screen:expect([[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
|
## grid 2
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
end)
describe('vertically', function ()
it('allocates grids', function ()
command('vsp')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('resizes grids', function ()
command('vsp')
command('vertical resize 10')
-- see "Note 1" for info about why there are two vseps
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
[3:----------]{12:│}[2:------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:<No Name] }{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('splits horizontally', function ()
command('vsp')
command('sp')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
2018-12-18 04:50:44 -07:00
{12:[No Name] [No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
insert('hello')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] [+] }{12:}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
2018-12-18 04:50:44 -07:00
{12:[No Name] [+] [No Name] [+] }|
|
## grid 2
hello |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
hello |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
hell^o |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
2018-11-17 10:23:42 -07:00
]])
2018-12-18 04:50:44 -07:00
end)
it('closes splits', function ()
command('vsp')
2018-11-17 10:23:42 -07:00
screen:expect([[
## grid 1
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
2018-12-18 04:50:44 -07:00
command('q')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
|
## grid 2
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
end)
end)
describe('on resize', function ()
it('rebuilds all grids', function ()
screen:try_resize(25, 6)
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
[2:-------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
|
## grid 2
^ |
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('has minimum width/height values', function()
screen:try_resize(1, 1)
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
|
## grid 2
^ |
]])
feed('<esc>:ls')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
:ls^ |
## grid 2
|
]])
end)
end)
describe('grid of smaller inner size', function()
it('is rendered correctly', function()
screen:try_resize_grid(2, 8, 5)
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
|
## grid 2
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
end)
describe('grid of bigger inner size', function()
it('is rendered correctly', function()
screen:try_resize_grid(2, 80, 20)
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
|
## grid 2
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
end)
2018-12-18 04:50:44 -07:00
describe('with resized grid', function()
before_each(function()
screen:try_resize_grid(2, 60, 20)
end)
it('gets written till grid width', function()
insert(('a'):rep(60).."\n")
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] [+] }|
|
## grid 2
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('wraps with grid width', function()
insert(('b'):rep(80).."\n")
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] [+] }|
|
## grid 2
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbb |
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('displays messages with default grid width', function()
command('echomsg "this is a very very very very very very very very'..
' long message"')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] }|
this is a very very very...ry very very long message |
## grid 2
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('creates folds with grid width', function()
insert('this is a fold\nthis is inside fold\nthis is outside fold')
feed('kzfgg')
screen:expect([[
## grid 1
2018-11-17 10:23:42 -07:00
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
2018-12-18 04:50:44 -07:00
{11:[No Name] [+] }|
|
## grid 2
{13:^+-- 2 lines: this is a fold································}|
this is outside fold |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
end)
it('multiline messages scroll over windows', function()
command('sp')
command('vsp')
screen:expect([[
## grid 1
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
{11:[No Name] }{12:[No Name] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
feed(":echoerr 'very' | echoerr 'much' | echoerr 'fail'<cr>")
screen:expect([[
## grid 1
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
{11:[No Name] }{12:[No Name] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11: }|
{14:very} |
{14:much} |
{14:fail} |
{15:Press ENTER or type command to continue}^ |
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
feed('<cr>')
screen:expect([[
## grid 1
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
{11:[No Name] }{12:[No Name] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
command([[
func! ErrMsg()
2018-12-23 10:37:45 -07:00
for i in range(11)
echoerr "error ".i
endfor
endfunc]])
feed(":call ErrMsg()<cr>")
screen:expect([[
## grid 1
{14:Error detected while processing function ErrMsg:} |
{19:line 2:} |
{14:error 0} |
{14:error 1} |
{14:error 2} |
{14:error 3} |
{14:error 4} |
{14:error 5} |
{14:error 6} |
{14:error 7} |
{14:error 8} |
{14:error 9} |
{14:error 10} |
2018-12-23 10:37:45 -07:00
{15:Press ENTER or type command to continue}^ |
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
feed("<c-c>")
screen:expect([[
## grid 1
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
[4:--------------------------]{12:│}[3:--------------------------]|
{11:[No Name] }{12:[No Name] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
it('handles switch tabs', function()
command('vsp')
screen:expect([[
## grid 1
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
command('tabnew')
-- note the old grids aren't resized yet
screen:expect([[
## grid 1
{16: }{17:2}{16: [No Name] }{7: [No Name] }{12: }{16:X}|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2 (hidden)
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3 (hidden)
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
command('sp')
screen:expect([[
## grid 1
{16: }{17:2}{16: [No Name] }{7: }{18:2}{7: [No Name] }{12: }{16:X}|
[5:-----------------------------------------------------]|
[5:-----------------------------------------------------]|
[5:-----------------------------------------------------]|
[5:-----------------------------------------------------]|
[5:-----------------------------------------------------]|
{11:[No Name] }|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2 (hidden)
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3 (hidden)
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 5
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
command('tabnext')
screen:expect([[
## grid 1
{7: }{18:2}{7: [No Name] }{16: }{17:2}{16: [No Name] }{12: }{16:X}|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4 (hidden)
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 5 (hidden)
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
command('tabnext')
screen:expect([[
## grid 1
{16: }{17:2}{16: [No Name] }{7: }{18:2}{7: [No Name] }{12: }{16:X}|
[5:-----------------------------------------------------]|
[5:-----------------------------------------------------]|
[5:-----------------------------------------------------]|
[5:-----------------------------------------------------]|
[5:-----------------------------------------------------]|
{11:[No Name] }|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2 (hidden)
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3 (hidden)
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 4
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 5
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
command('tabclose')
screen:expect([[
## grid 1
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
[3:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:[No Name] }|
|
## grid 2
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
2019-01-01 04:46:47 -07:00
it('supports mouse', function()
insert('some text\nto be clicked')
screen:expect([[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] [+] }|
|
## grid 2
some text |
to be clicke^d |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
meths.input_mouse('left', 'press', '', 2, 0, 5)
screen:expect([[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] [+] }|
|
## grid 2
some ^text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
feed(':new<cr>')
insert('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo')
screen:expect([[
## grid 1
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{11:[No Name] [+] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] [+] }|
|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
Lorem ipsum dolor sit amet, consectetur adipiscing el|
it, sed do eiusm^o |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
meths.input_mouse('left', 'press', '', 2, 1, 6)
screen:expect([[
## grid 1
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{12:[No Name] [+] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] [+] }|
|
## grid 2
some text |
to be ^clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
Lorem ipsum dolor sit amet, consectetur adipiscing el|
it, sed do eiusmo |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
meths.input_mouse('left', 'press', '', 3, 1, 4)
screen:expect([[
## grid 1
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{11:[No Name] [+] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] [+] }|
|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
Lorem ipsum dolor sit amet, consectetur adipiscing el|
it, ^sed do eiusmo |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
screen:try_resize_grid(3, 80, 2)
screen:expect([[
## grid 1
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{11:[No Name] [+] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] [+] }|
|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
Lorem ipsum dolor sit amet, consectetur adipiscing elit, ^sed do eiusmo |
{1:~ }|
]])
meths.input_mouse('left', 'press', '', 3, 0, 64)
screen:expect([[
## grid 1
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{11:[No Name] [+] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] [+] }|
|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ^eiusmo |
{1:~ }|
]])
meths.input_mouse('left', 'press', '', 1,6, 20)
-- TODO(bfredl): "batching" input_mouse is formally not supported yet.
-- Normally it should work fine in async context when nvim is not blocked,
-- but add a wait be sure.
wait()
meths.input_mouse('left', 'drag', '', 1, 4, 20)
screen:expect([[
## grid 1
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{11:[No Name] [+] }|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{12:[No Name] [+] }|
|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ^eiusmo |
{1:~ }|
]])
feed('<c-w><c-w><c-w>v')
screen:expect([[
## grid 1
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{12:[No Name] [+] }|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
[4:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] [+] }{12:[No Name] [+] }|
|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
{1:~ }|
## grid 4
some text |
to be ^clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
meths.input_mouse('left', 'press', '', 1,8, 26)
wait()
meths.input_mouse('left', 'drag', '', 1, 6, 30)
screen:expect([[
## grid 1
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
[3:-----------------------------------------------------]|
{12:[No Name] [+] }|
[4:------------------------------]{12:│}[2:----------------------]|
[4:------------------------------]{12:│}[2:----------------------]|
[4:------------------------------]{12:│}[2:----------------------]|
[4:------------------------------]{12:│}[2:----------------------]|
[4:------------------------------]{12:│}[2:----------------------]|
[4:------------------------------]{12:│}[2:----------------------]|
[4:------------------------------]{12:│}[2:----------------------]|
{11:[No Name] [+] }{12:[No Name] [+] }|
|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
{1:~ }|
## grid 4
some text |
to be ^clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
end)
2018-12-18 04:50:44 -07:00
end)