aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/float_spec.lua207
-rw-r--r--test/functional/ui/multigrid_spec.lua171
-rw-r--r--test/functional/ui/output_spec.lua6
-rw-r--r--test/functional/ui/popupmenu_spec.lua4
-rw-r--r--test/functional/ui/screen.lua7
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua42
6 files changed, 379 insertions, 58 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index be22d9a403..ccf5f963d1 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -153,6 +153,132 @@ describe('float window', function()
eq(10, width)
end)
+ it('opened with correct position', function()
+ local pos = exec_lua([[
+ local bufnr = vim.api.nvim_create_buf(false, true)
+
+ local opts = {
+ width = 10,
+ height = 10,
+ col = 7,
+ row = 9,
+ relative = 'editor',
+ style = 'minimal'
+ }
+
+ local win_id = vim.api.nvim_open_win(bufnr, false, opts)
+
+ return vim.api.nvim_win_get_position(win_id)
+ ]])
+
+ eq(9, pos[1])
+ eq(7, pos[2])
+ end)
+
+ it('opened with correct position relative to the cursor', function()
+ local pos = exec_lua([[
+ local bufnr = vim.api.nvim_create_buf(false, true)
+
+ local opts = {
+ width = 10,
+ height = 10,
+ col = 7,
+ row = 9,
+ relative = 'cursor',
+ style = 'minimal'
+ }
+
+ local win_id = vim.api.nvim_open_win(bufnr, false, opts)
+
+ return vim.api.nvim_win_get_position(win_id)
+ ]])
+
+ eq(9, pos[1])
+ eq(7, pos[2])
+ end)
+
+ it('opened with correct position relative to another window', function()
+ local pos = exec_lua([[
+ local bufnr = vim.api.nvim_create_buf(false, true)
+
+ local par_opts = {
+ width = 50,
+ height = 50,
+ col = 7,
+ row = 9,
+ relative = 'editor',
+ style = 'minimal'
+ }
+
+ local par_win_id = vim.api.nvim_open_win(bufnr, false, par_opts)
+
+ local opts = {
+ width = 10,
+ height = 10,
+ col = 7,
+ row = 9,
+ relative = 'win',
+ style = 'minimal',
+ win = par_win_id
+ }
+
+ local win_id = vim.api.nvim_open_win(bufnr, false, opts)
+
+ return vim.api.nvim_win_get_position(win_id)
+ ]])
+
+ eq(18, pos[1])
+ eq(14, pos[2])
+ end)
+
+
+ it('opened with correct position relative to another relative window', function()
+ local pos = exec_lua([[
+ local bufnr = vim.api.nvim_create_buf(false, true)
+
+ local root_opts = {
+ width = 50,
+ height = 50,
+ col = 7,
+ row = 9,
+ relative = 'editor',
+ style = 'minimal'
+ }
+
+ local root_win_id = vim.api.nvim_open_win(bufnr, false, root_opts)
+
+ local par_opts = {
+ width = 20,
+ height = 20,
+ col = 2,
+ row = 3,
+ relative = 'win',
+ win = root_win_id,
+ style = 'minimal'
+ }
+
+ local par_win_id = vim.api.nvim_open_win(bufnr, false, par_opts)
+
+ local opts = {
+ width = 10,
+ height = 10,
+ col = 3,
+ row = 2,
+ relative = 'win',
+ win = par_win_id,
+ style = 'minimal'
+ }
+
+ local win_id = vim.api.nvim_open_win(bufnr, false, opts)
+
+ return vim.api.nvim_win_get_position(win_id)
+ ]])
+
+ eq(14, pos[1])
+ eq(12, pos[2])
+ end)
+
+
local function with_ext_multigrid(multigrid)
local screen
before_each(function()
@@ -782,8 +908,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -825,8 +951,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -868,8 +994,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -911,8 +1037,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -955,8 +1081,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -996,8 +1122,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -1037,8 +1163,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -1087,8 +1213,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0, linecount = 6};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
}}
else
screen:expect{grid=[[
@@ -1138,8 +1264,8 @@ describe('float window', function()
]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 0, 0, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
@@ -1196,8 +1322,8 @@ describe('float window', function()
]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 0, 5, true }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3};
}}
else
screen:expect{grid=[[
@@ -1255,8 +1381,8 @@ describe('float window', function()
[5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 },
[6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 }
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3};
}}
else
screen:expect{grid=[[
@@ -1705,6 +1831,7 @@ describe('float window', function()
botline = 3,
curline = 0,
curcol = 3,
+ linecount = 2,
win = { id = 1000 }
},
[4] = {
@@ -1712,6 +1839,7 @@ describe('float window', function()
botline = 3,
curline = 0,
curcol = 3,
+ linecount = 2,
win = { id = 1001 }
},
[5] = {
@@ -1719,6 +1847,7 @@ describe('float window', function()
botline = 2,
curline = 0,
curcol = 0,
+ linecount = 1,
win = { id = 1002 }
}
}}
@@ -5036,7 +5165,7 @@ describe('float window', function()
]])
end
- eq(2, eval('1+1'))
+ assert_alive()
end)
it("o (:only) non-float", function()
@@ -6339,8 +6468,8 @@ describe('float window', function()
]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 2, 5, true };
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
@@ -6396,10 +6525,10 @@ describe('float window', function()
[5] = { { id = 1002 }, "NW", 1, 3, 8, true };
[6] = { { id = 1003 }, "NW", 1, 4, 10, true };
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
+ [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
}}
else
screen:expect{grid=[[
@@ -6444,8 +6573,8 @@ describe('float window', function()
]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 2, 5, true };
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
@@ -6501,10 +6630,10 @@ describe('float window', function()
[5] = { { id = 1002 }, "NW", 1, 4, 10, true };
[6] = { { id = 1003 }, "NW", 1, 3, 8, true };
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
@@ -6564,10 +6693,10 @@ describe('float window', function()
[5] = {{id = 1002}, "NW", 1, 2, 6, true, 50};
[6] = {{id = 1003}, "NW", 1, 3, 7, true, 40};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
- [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
}}
else
screen:expect{grid=[[
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index 719e2ee82a..4e5e9c3a71 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -34,6 +34,7 @@ describe('ext_multigrid', function()
[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},
+ [20] = {background = Screen.colors.LightGrey},
})
end)
@@ -2034,6 +2035,66 @@ describe('ext_multigrid', function()
]]}
end)
+ it('supports mouse drag with mouse=a', function()
+ command('set mouse=a')
+ command('vsplit')
+ command('wincmd l')
+ command('split')
+ command('enew')
+ feed('ifoo\nbar<esc>')
+
+ meths.input_mouse('left', 'press', '', 5, 0, 0)
+ poke_eventloop()
+ meths.input_mouse('left', 'drag', '', 5, 1, 2)
+
+ screen:expect{grid=[[
+ ## grid 1
+ [4:--------------------------]{12:│}[5:--------------------------]|
+ [4:--------------------------]{12:│}[5:--------------------------]|
+ [4:--------------------------]{12:│}[5:--------------------------]|
+ [4:--------------------------]{12:│}[5:--------------------------]|
+ [4:--------------------------]{12:│}[5:--------------------------]|
+ [4:--------------------------]{12:│}[5:--------------------------]|
+ [4:--------------------------]{12:│}{11:[No Name] [+] }|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ {12:[No Name] [No Name] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ## grid 4
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 5
+ {20:foo} |
+ {20:ba}^r |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+
+ end)
+
it('has viewport information', function()
screen:try_resize(48, 8)
screen:expect{grid=[[
@@ -2056,7 +2117,7 @@ describe('ext_multigrid', function()
## grid 3
|
]], win_viewport={
- [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0}
+ [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}
}}
insert([[
Lorem ipsum dolor sit amet, consectetur
@@ -2091,7 +2152,7 @@ describe('ext_multigrid', function()
## grid 3
|
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7},
+ [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11},
}}
@@ -2116,7 +2177,7 @@ describe('ext_multigrid', function()
## grid 3
|
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0},
+ [2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0, linecount = 11},
}}
command("split")
@@ -2140,8 +2201,8 @@ describe('ext_multigrid', function()
reprehenderit in voluptate velit esse cillum |
^dolore eu fugiat nulla pariatur. Excepteur sint |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
- [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0},
+ [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11},
+ [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0, linecount = 11},
}}
feed("b")
@@ -2165,8 +2226,8 @@ describe('ext_multigrid', function()
reprehenderit in voluptate velit esse ^cillum |
dolore eu fugiat nulla pariatur. Excepteur sint |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
- [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38},
+ [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11},
+ [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38, linecount = 11},
}}
feed("2k")
@@ -2190,8 +2251,8 @@ describe('ext_multigrid', function()
ea commodo consequat. Duis aute irure dolor in |
reprehenderit in voluptate velit esse cillum |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
- [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38},
+ [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11},
+ [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11},
}}
-- handles non-current window
@@ -2216,8 +2277,96 @@ describe('ext_multigrid', function()
ea commodo consequat. Duis aute irure dolor in |
reprehenderit in voluptate velit esse cillum |
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10},
- [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38},
+ [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11},
+ [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11},
+ }}
+ end)
+
+ it('does not crash when dragging mouse across grid boundary', function()
+ screen:try_resize(48, 8)
+ screen:expect{grid=[[
+ ## grid 1
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ {11:[No Name] }|
+ [3:------------------------------------------------]|
+ ## grid 2
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]], win_viewport={
+ [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}
+ }}
+ insert([[
+ Lorem ipsum dolor sit amet, consectetur
+ adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua.
+ Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex
+ ea commodo consequat. Duis aute irure dolor in
+ reprehenderit in voluptate velit esse cillum
+ dolore eu fugiat nulla pariatur. Excepteur sint
+ occaecat cupidatat non proident, sunt in culpa
+ qui officia deserunt mollit anim id est
+ laborum.]])
+
+ screen:expect{grid=[[
+ ## grid 1
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:------------------------------------------------]|
+ ## grid 2
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ laborum^. |
+ ## grid 3
+ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11},
+ }}
+
+ meths.input_mouse('left', 'press', '', 1,5, 1)
+ poke_eventloop()
+ meths.input_mouse('left', 'drag', '', 1, 6, 1)
+
+ screen:expect{grid=[[
+ ## grid 1
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ [2:------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:------------------------------------------------]|
+ ## grid 2
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ l^aborum. |
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 6, botline = 12, curline = 10, curcol = 1, linecount = 11},
}}
end)
end)
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index 3826707743..50e5dfac84 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -1,9 +1,9 @@
local Screen = require('test.functional.ui.screen')
local helpers = require('test.functional.helpers')(after_each)
local child_session = require('test.functional.terminal.helpers')
+local assert_alive = helpers.assert_alive
local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
local eq = helpers.eq
-local eval = helpers.eval
local feed = helpers.feed
local feed_command = helpers.feed_command
local iswin = helpers.iswin
@@ -86,12 +86,12 @@ describe("shell command :!", function()
it("cat a binary file #4142", function()
feed(":exe 'silent !cat '.shellescape(v:progpath)<CR>")
- eq(2, eval('1+1')) -- Still alive?
+ assert_alive()
end)
it([[display \x08 char #4142]], function()
feed(":silent !echo \08<CR>")
- eq(2, eval('1+1')) -- Still alive?
+ assert_alive()
end)
it('handles control codes', function()
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 0944bfc21a..aeba049557 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -1,5 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
+local assert_alive = helpers.assert_alive
local clear, feed = helpers.clear, helpers.feed
local source = helpers.source
local insert = helpers.insert
@@ -9,7 +10,6 @@ local funcs = helpers.funcs
local get_pathsep = helpers.get_pathsep
local eq = helpers.eq
local pcall_err = helpers.pcall_err
-local eval = helpers.eval
describe('ui/ext_popupmenu', function()
local screen
@@ -2211,6 +2211,6 @@ describe('builtin popupmenu', function()
feed('$i')
funcs.complete(col - max_len, items)
feed('<c-y>')
- eq(2, eval('1+1'))
+ assert_alive()
end)
end)
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index f73d051857..61f19c3794 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -773,13 +773,14 @@ function Screen:_handle_win_pos(grid, win, startrow, startcol, width, height)
self.float_pos[grid] = nil
end
-function Screen:_handle_win_viewport(grid, win, topline, botline, curline, curcol)
+function Screen:_handle_win_viewport(grid, win, topline, botline, curline, curcol, linecount)
self.win_viewport[grid] = {
win = win,
topline = topline,
botline = botline,
curline = curline,
- curcol = curcol
+ curcol = curcol,
+ linecount = linecount
}
end
@@ -1306,7 +1307,7 @@ local function fmt_ext_state(name, state)
for k,v in pairs(state) do
str = (str.." ["..k.."] = {win = {id = "..v.win.id.."}, topline = "
..v.topline..", botline = "..v.botline..", curline = "..v.curline
- ..", curcol = "..v.curcol.."};\n")
+ ..", curcol = "..v.curcol..", linecount = "..v.linecount.."};\n")
end
return str .. "}"
elseif name == "float_pos" then
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
index d1af0e955c..4e1852162f 100644
--- a/test/functional/ui/syntax_conceal_spec.lua
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -913,4 +913,46 @@ describe('Screen', function()
]]}
eq(grid_lines, {{2, 0, {{'c', 0, 3}}}})
end)
+
+ -- Copy of Test_cursor_column_in_concealed_line_after_window_scroll in
+ -- test/functional/ui/syntax_conceal_spec.lua.
+ describe('concealed line after window scroll', function()
+ after_each(function()
+ command(':qall!')
+ os.remove('Xcolesearch')
+ end)
+
+ it('has the correct cursor column', function()
+ insert([[
+ 3split
+ let m = matchadd('Conceal', '=')
+ setl conceallevel=2 concealcursor=nc
+ normal gg
+ "==expr==
+ ]])
+
+ command('write Xcolesearch')
+ feed(":so %<CR>")
+
+ -- Jump to something that is beyond the bottom of the window,
+ -- so there's a scroll down.
+ feed("/expr<CR>")
+
+ -- Are the concealed parts of the current line really hidden?
+ -- Is the window's cursor column properly updated for hidden
+ -- parts of the current line?
+ screen:expect{grid=[[
+ setl conceallevel2 concealcursornc |
+ normal gg |
+ "{5:^expr} |
+ {2:Xcolesearch }|
+ normal gg |
+ "=={5:expr}== |
+ |
+ {0:~ }|
+ {3:Xcolesearch }|
+ /expr |
+ ]]}
+ end)
+ end)
end)