aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/multigrid_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui/multigrid_spec.lua')
-rw-r--r--test/functional/ui/multigrid_spec.lua170
1 files changed, 152 insertions, 18 deletions
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index c1d3af085f..dc48061a6c 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -1,12 +1,14 @@
-local helpers = require('test.functional.helpers')(after_each)
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = helpers.clear
-local feed, command, insert = helpers.feed, helpers.command, helpers.insert
-local eq = helpers.eq
-local fn = helpers.fn
-local api = helpers.api
-local curwin = helpers.api.nvim_get_current_win
-local poke_eventloop = helpers.poke_eventloop
+
+local clear = n.clear
+local feed, command, insert = n.feed, n.command, n.insert
+local eq = t.eq
+local fn = n.fn
+local api = n.api
+local curwin = n.api.nvim_get_current_win
+local poke_eventloop = n.poke_eventloop
describe('ext_multigrid', function()
@@ -412,9 +414,23 @@ describe('ext_multigrid', function()
end)
describe('grid of smaller inner size', function()
+ before_each(function()
+ screen:try_resize_grid(2, 20, 5)
+ end)
+
it('is rendered correctly', function()
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|*12
+ {11:[No Name] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ ^ |
+ {1:~ }|*4
+ ## grid 3
+ |
+ ]]}
screen:try_resize_grid(2, 8, 5)
-
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|*12
@@ -427,12 +443,43 @@ describe('ext_multigrid', function()
|
]]}
end)
+
+ it("cursor draws correctly with double-width char and 'showbreak'", function()
+ insert(('a'):rep(19) .. '哦bbbb')
+ command('setlocal showbreak=++')
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|*12
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ aaaaaaaaaaaaaaaaaaa{1:>}|
+ {1:++}哦bbb^b |
+ {1:~ }|*3
+ ## grid 3
+ |
+ ]]}
+ end)
end)
describe('grid of bigger inner size', function()
+ before_each(function()
+ screen:try_resize_grid(2, 60, 20)
+ end)
+
it('is rendered correctly', function()
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|*12
+ {11:[No Name] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ ^ |
+ {1:~ }|*19
+ ## grid 3
+ |
+ ]]}
screen:try_resize_grid(2, 80, 20)
-
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|*12
@@ -445,13 +492,6 @@ describe('ext_multigrid', function()
|
]]}
end)
- end)
-
-
- describe('with resized grid', function()
- before_each(function()
- screen:try_resize_grid(2, 60, 20)
- end)
it('winwidth() winheight() getwininfo() return inner width and height #19743', function()
eq(60, fn.winwidth(0))
@@ -483,7 +523,7 @@ describe('ext_multigrid', function()
]]}
end)
- it('"g$" works correctly with double-width characters and no wrapping', function()
+ it('g$ works correctly with double-width chars and no wrapping', function()
command('set nowrap')
insert(('a'):rep(58) .. ('哦'):rep(3))
feed('0')
@@ -543,6 +583,22 @@ describe('ext_multigrid', function()
## grid 3
|
]]}
+ command('setlocal breakindent breakindentopt=shift:8')
+ feed('g$')
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|*12
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ {23:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb^b}|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
+ |
+ {1:~ }|*16
+ ## grid 3
+ |
+ ]]}
end)
it('displays messages with default grid width', function()
@@ -685,6 +741,75 @@ describe('ext_multigrid', function()
[4] = {-1, "SW", 1, 13, 5, false, 250};
}}
end)
+
+ it('half-page scrolling stops at end of buffer', function()
+ command('set number')
+ insert(('foobar\n'):rep(100))
+ feed('7<C-Y>')
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:-----------------------------------------------------]|*12
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ {19: 75 }foobar |
+ {19: 76 }foobar |
+ {19: 77 }foobar |
+ {19: 78 }foobar |
+ {19: 79 }foobar |
+ {19: 80 }foobar |
+ {19: 81 }foobar |
+ {19: 82 }foobar |
+ {19: 83 }foobar |
+ {19: 84 }foobar |
+ {19: 85 }foobar |
+ {19: 86 }foobar |
+ {19: 87 }foobar |
+ {19: 88 }foobar |
+ {19: 89 }foobar |
+ {19: 90 }foobar |
+ {19: 91 }foobar |
+ {19: 92 }foobar |
+ {19: 93 }foobar |
+ {19: 94 }^foobar |
+ ## grid 3
+ |
+ ]],
+ })
+ feed('<C-D>')
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:-----------------------------------------------------]|*12
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ {19: 82 }foobar |
+ {19: 83 }foobar |
+ {19: 84 }foobar |
+ {19: 85 }foobar |
+ {19: 86 }foobar |
+ {19: 87 }foobar |
+ {19: 88 }foobar |
+ {19: 89 }foobar |
+ {19: 90 }foobar |
+ {19: 91 }foobar |
+ {19: 92 }foobar |
+ {19: 93 }foobar |
+ {19: 94 }foobar |
+ {19: 95 }foobar |
+ {19: 96 }foobar |
+ {19: 97 }foobar |
+ {19: 98 }foobar |
+ {19: 99 }foobar |
+ {19:100 }foobar |
+ {19:101 }^ |
+ ## grid 3
+ |
+ ]],
+ })
+ end)
end)
it('multiline messages scroll over windows', function()
@@ -2300,6 +2425,9 @@ describe('ext_multigrid', function()
]], win_viewport={
[2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ }, win_viewport_margins={
+ [2] = {win = 1000, top = 0, bottom = 0, left = 0, right = 0};
+ [4] = {win = 1001, top = 0, bottom = 0, left = 0, right = 0};
}}
-- XXX: hack to get notifications. Could use next_msg() also.
@@ -2330,6 +2458,9 @@ describe('ext_multigrid', function()
]], win_viewport={
[2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ }, win_viewport_margins={
+ [2] = {win = 1000, top = 0, bottom = 0, left = 0, right = 0};
+ [4] = {win = 1001, top = 1, bottom = 0, left = 0, right = 0};
}}
eq({}, win_pos)
@@ -2352,6 +2483,9 @@ describe('ext_multigrid', function()
]], win_viewport={
[2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ }, win_viewport_margins={
+ [2] = {win = 1000, top = 0, bottom = 0, left = 0, right = 0};
+ [4] = {win = 1001, top = 0, bottom = 0, left = 0, right = 0};
}}
eq({}, win_pos)
end)