aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/float_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:39:54 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:39:54 +0000
commit21cb7d04c387e4198ca8098a884c78b56ffcf4c2 (patch)
tree84fe5690df1551f0bb2bdfe1a13aacd29ebc1de7 /test/functional/ui/float_spec.lua
parentd9c904f85a23a496df4eb6be42aa43f007b22d50 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-colorcolchar.tar.gz
rneovim-colorcolchar.tar.bz2
rneovim-colorcolchar.zip
Merge remote-tracking branch 'upstream/master' into colorcolcharcolorcolchar
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r--test/functional/ui/float_spec.lua3002
1 files changed, 2671 insertions, 331 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 6759510ad1..2902b4a4a5 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -9,6 +9,7 @@ local eval = helpers.eval
local eq = helpers.eq
local neq = helpers.neq
local expect = helpers.expect
+local exec = helpers.exec
local exec_lua = helpers.exec_lua
local insert = helpers.insert
local meths = helpers.meths
@@ -65,20 +66,20 @@ describe('float window', function()
it('closed immediately by autocmd #11383', function()
eq('Window was closed immediately',
pcall_err(exec_lua, [[
- local a = vim.api
+ local api = vim.api
local function crashes(contents)
- local buf = a.nvim_create_buf(false, true)
- local floatwin = a.nvim_open_win(buf, true, {
+ local buf = api.nvim_create_buf(false, true)
+ local floatwin = api.nvim_open_win(buf, true, {
relative = 'cursor';
style = 'minimal';
row = 0; col = 0;
height = #contents;
width = 10;
})
- a.nvim_buf_set_lines(buf, 0, -1, true, contents)
+ api.nvim_buf_set_lines(buf, 0, -1, true, contents)
local winnr = vim.fn.win_id2win(floatwin)
- a.nvim_command('wincmd p')
- a.nvim_command('autocmd CursorMoved * ++once '..winnr..'wincmd c')
+ api.nvim_command('wincmd p')
+ api.nvim_command('autocmd BufEnter * ++once '..winnr..'wincmd c')
return buf, floatwin
end
crashes{'foo'}
@@ -102,9 +103,32 @@ describe('float window', function()
assert_alive()
end)
+ it('open with WinNew autocmd', function()
+ local res = exec_lua([[
+ local triggerd = false
+ local buf = vim.api.nvim_create_buf(true, true)
+ vim.api.nvim_create_autocmd('WinNew', {
+ callback = function(opt)
+ if opt.buf == buf then
+ triggerd = true
+ end
+ end
+ })
+ local opts = {
+ relative = "win",
+ row = 0, col = 0,
+ width = 1, height = 1,
+ noautocmd = false,
+ }
+ vim.api.nvim_open_win(buf, true, opts)
+ return triggerd
+ ]])
+ eq(true, res)
+ end)
+
it('opened with correct height', function()
local height = exec_lua([[
- vim.api.nvim_set_option("winheight", 20)
+ vim.go.winheight = 20
local bufnr = vim.api.nvim_create_buf(false, true)
local opts = {
@@ -126,7 +150,7 @@ describe('float window', function()
it('opened with correct width', function()
local width = exec_lua([[
- vim.api.nvim_set_option("winwidth", 20)
+ vim.go.winwidth = 20
local bufnr = vim.api.nvim_create_buf(false, true)
local opts = {
@@ -414,6 +438,46 @@ describe('float window', function()
eq(winids, eval('winids'))
end)
+ it("open does not trigger BufEnter #15300", function()
+ local res = exec_lua[[
+ local times = {}
+ local buf = vim.api.nvim_create_buf(fasle, true)
+ vim.api.nvim_create_autocmd('BufEnter', {
+ callback = function(opt)
+ if opt.buf == buf then
+ times[#times + 1] = 1
+ end
+ end
+ })
+ local win_id
+ local fconfig = {
+ relative = 'editor',
+ row = 10,
+ col = 10,
+ width = 10,
+ height = 10,
+ }
+ --enter is false doesn't trigger
+ win_id = vim.api.nvim_open_win(buf, false, fconfig)
+ vim.api.nvim_win_close(win_id, true)
+ times[#times + 1] = #times == 0 and true or nil
+
+ --enter is true trigger
+ win_id = vim.api.nvim_open_win(buf, true, fconfig)
+ vim.api.nvim_win_close(win_id, true)
+ times[#times + 1] = #times == 2 and true or nil
+
+ --enter is true and fconfig.noautocmd is true doesn't trigger
+ fconfig.noautocmd = true
+ win_id = vim.api.nvim_open_win(buf, true, fconfig)
+ vim.api.nvim_win_close(win_id, true)
+ times[#times + 1] = #times == 2 and true or nil
+
+ return times
+ ]]
+ eq({true, 1, true}, res)
+ end)
+
it('no crash with bufpos and non-existent window', function()
command('new')
local closed_win = meths.get_current_win().id
@@ -426,17 +490,57 @@ describe('float window', function()
it("no segfault when setting minimal style after clearing local 'fillchars' #19510", function()
local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1}
local float_win = meths.open_win(0, true, float_opts)
- meths.win_set_option(float_win, 'fillchars', NIL)
+ meths.set_option_value('fillchars', NIL, {win=float_win.id})
float_opts.style = 'minimal'
meths.win_set_config(float_win, float_opts)
assert_alive()
+ end)
+
+ it("should re-apply 'style' when present", function()
+ local float_opts = {style = 'minimal', relative = 'editor', row = 1, col = 1, width = 1, height = 1}
+ local float_win = meths.open_win(0, true, float_opts)
+ meths.set_option_value('number', true, { win = float_win })
+ float_opts.row = 2
+ meths.win_set_config(float_win, float_opts)
+ eq(false, meths.get_option_value('number', { win = float_win }))
+ end)
+
+ it("should not re-apply 'style' when missing", function()
+ local float_opts = {style = 'minimal', relative = 'editor', row = 1, col = 1, width = 1, height = 1}
+ local float_win = meths.open_win(0, true, float_opts)
+ meths.set_option_value('number', true, { win = float_win })
+ float_opts.row = 2
+ float_opts.style = nil
+ meths.win_set_config(float_win, float_opts)
+ eq(true, meths.get_option_value('number', { win = float_win }))
end)
it("'scroll' is computed correctly when opening float with splitkeep=screen #20684", function()
- meths.set_option('splitkeep', 'screen')
+ meths.set_option_value('splitkeep', 'screen', {})
local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10}
local float_win = meths.open_win(0, true, float_opts)
- eq(5, meths.win_get_option(float_win, 'scroll'))
+ eq(5, meths.get_option_value('scroll', {win=float_win.id}))
+ end)
+
+ it(':unhide works when there are floating windows', function()
+ local float_opts = {relative = 'editor', row = 1, col = 1, width = 5, height = 5}
+ local w0 = curwin()
+ meths.open_win(0, false, float_opts)
+ meths.open_win(0, false, float_opts)
+ eq(3, #meths.list_wins())
+ command('unhide')
+ eq({ w0 }, meths.list_wins())
+ end)
+
+ it(':all works when there are floating windows', function()
+ command('args Xa.txt')
+ local float_opts = {relative = 'editor', row = 1, col = 1, width = 5, height = 5}
+ local w0 = curwin()
+ meths.open_win(0, false, float_opts)
+ meths.open_win(0, false, float_opts)
+ eq(3, #meths.list_wins())
+ command('all')
+ eq({ w0 }, meths.list_wins())
end)
describe('with only one tabpage,', function()
@@ -738,7 +842,7 @@ describe('float window', function()
[4] = {bold = true, reverse = true},
[5] = {reverse = true},
[6] = {background = Screen.colors.LightMagenta, bold = true, reverse = true},
- [7] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [7] = {foreground = Screen.colors.White, background = Screen.colors.Red},
[8] = {bold = true, foreground = Screen.colors.SeaGreen4},
[9] = {background = Screen.colors.LightGrey, underline = true},
[10] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Magenta},
@@ -879,6 +983,71 @@ describe('float window', function()
end
end)
+ it('window position fixed', function()
+ command('rightbelow 20vsplit')
+ local buf = meths.create_buf(false,false)
+ local win = meths.open_win(buf, false, {
+ relative='win', width=15, height=2, row=2, col=10, anchor='NW', fixed=true})
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ {5:[No Name] }{4:[No Name] }|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 5
+ {1: }|
+ {2:~ }|
+ ]], float_pos={
+ [5] = {{id = 1002}, "NW", 4, 2, 10, true};
+ }}
+ else
+ screen:expect([[
+ {5:│}^ |
+ {0:~ }{5:│}{0:~ }|
+ {0:~ }{5:│}{0:~ }{1: }|
+ {0:~ }{5:│}{0:~ }{2:~ }|
+ {0:~ }{5:│}{0:~ }|
+ {5:[No Name] }{4:[No Name] }|
+ |
+ ]])
+ end
+
+ meths.win_set_config(win, {fixed=false})
+
+ if multigrid then
+ screen:expect_unchanged()
+ else
+ screen:expect([[
+ {5:│}^ |
+ {0:~ }{5:│}{0:~ }|
+ {0:~ }{5:│}{0:~ }{1: }|
+ {0:~ }{5:│}{0:~ }{2:~ }|
+ {0:~ }{5:│}{0:~ }|
+ {5:[No Name] }{4:[No Name] }|
+ |
+ ]])
+ end
+ end)
+
it('draws correctly with redrawdebug=compositor', function()
-- NB: we do not test that it produces the "correct" debug info
-- (as it is intermediate only, and is allowed to change by internal
@@ -1003,14 +1172,14 @@ describe('float window', function()
it('return their configuration', function()
local buf = meths.create_buf(false, false)
local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60})
- local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60}
+ local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false}
eq(expected, meths.win_get_config(win))
- eq({relative='', external=false, focusable=true}, meths.win_get_config(0))
+ eq({relative='', external=false, focusable=true, hide=false}, meths.win_get_config(0))
if multigrid then
meths.win_set_config(win, {external=true, width=10, height=1})
- eq({external=true,focusable=true,width=10,height=1,relative=''}, meths.win_get_config(win))
+ eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, meths.win_get_config(win))
end
end)
@@ -1425,16 +1594,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:╔═════════╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1468,16 +1637,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:┌─────────┐}|
{5:│}{1: halloj! }{5:│}|
{5:│}{1: BORDAA }{5:│}|
{5:└─────────┘}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1511,16 +1680,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:╭─────────╮}|
{5:│}{1: halloj! }{5:│}|
{5:│}{1: BORDAA }{5:│}|
{5:╰─────────╯}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1554,16 +1723,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5: }|
{5: }{1: halloj! }{5: }|
{5: }{1: BORDAA }{5: }|
{5: }|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1598,16 +1767,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:x}{7:ååååååååå}{5:\}|
{17:n̈̊}{1: halloj! }{17:n̈̊}|
{17:n̈̊}{1: BORDAA }{17:n̈̊}|
{5:\}{7:ååååååååå}{5:x}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1641,14 +1810,14 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1: halloj! }|
{1: BORDAA }|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1682,14 +1851,14 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:<}{1: halloj! }{5:>}|
{5:<}{1: BORDAA }{5:>}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1723,16 +1892,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:_________}|
{1: halloj! }|
{1: BORDAA }|
{5:---------}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1774,15 +1943,15 @@ describe('float window', function()
^ |
## grid 3
|
- ## grid 5
+ ## grid 4
{1: halloj! }{25: }|
{1: BORDAA }{26: }|
{25: }{26: }|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0, linecount = 6, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1831,6 +2000,94 @@ describe('float window', function()
eq('center', title_pos)
end)
+ it('validates footer footer_pos', function()
+ local buf = meths.create_buf(false,false)
+ eq("footer requires border to be set",
+ pcall_err(meths.open_win,buf, false, {
+ relative='editor', width=9, height=2, row=2, col=5, footer='Footer',
+ }))
+ eq("footer_pos requires footer to be set",
+ pcall_err(meths.open_win,buf, false, {
+ relative='editor', width=9, height=2, row=2, col=5,
+ border='single', footer_pos='left',
+ }))
+ end)
+
+ it('validate footer_pos in nvim_win_get_config', function()
+ local footer_pos = exec_lua([[
+ local bufnr = vim.api.nvim_create_buf(false, false)
+ local opts = {
+ relative = 'editor',
+ col = 2,
+ row = 5,
+ height = 2,
+ width = 9,
+ border = 'double',
+ footer = 'Test',
+ footer_pos = 'center'
+ }
+
+ local win_id = vim.api.nvim_open_win(bufnr, true, opts)
+ return vim.api.nvim_win_get_config(win_id).footer_pos
+ ]])
+
+ eq('center', footer_pos)
+ end)
+
+ it('center aligned title longer than window width #25746', function()
+ local buf = meths.create_buf(false, false)
+ meths.buf_set_lines(buf, 0, -1, true, {' halloj! ',
+ ' BORDAA '})
+ local win = meths.open_win(buf, false, {
+ relative='editor', width=9, height=2, row=2, col=5, border="double",
+ title = "abcdefghijklmnopqrstuvwxyz",title_pos = "center",
+ })
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔}{11:abcdefghi}{5:╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚═════════╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔}{11:abcdefghi}{5:╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚═════════╝}{0: }|
+ |
+ ]]}
+ end
+
+ meths.win_close(win, false)
+ assert_alive()
+ end)
it('border with title', function()
local buf = meths.create_buf(false, false)
@@ -1860,16 +2117,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:╔}{11:Left}{5:═════╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1903,16 +2160,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:╔═}{11:Center}{5:══╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1946,16 +2203,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:╔════}{11:Right}{5:╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -1989,16 +2246,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:╔═════}🦄BB{5:╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -2013,9 +2270,376 @@ describe('float window', function()
end
end)
+ it('border with footer', function()
+ local buf = meths.create_buf(false, false)
+ meths.buf_set_lines(buf, 0, -1, true, {' halloj! ',
+ ' BORDAA '})
+ local win = meths.open_win(buf, false, {
+ relative='editor', width=9, height=2, row=2, col=5, border="double",
+ footer = "Left",footer_pos = "left",
+ })
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔═════════╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚}{11:Left}{5:═════╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔═════════╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚}{11:Left}{5:═════╝}{0: }|
+ |
+ ]]}
+ end
+
+ meths.win_set_config(win, {footer= "Center",footer_pos="center"})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔═════════╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚═}{11:Center}{5:══╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔═════════╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚═}{11:Center}{5:══╝}{0: }|
+ |
+ ]]}
+ end
+
+ meths.win_set_config(win, {footer= "Right",footer_pos="right"})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔═════════╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚════}{11:Right}{5:╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔═════════╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚════}{11:Right}{5:╝}{0: }|
+ |
+ ]]}
+ end
+
+ meths.win_set_config(win, {footer= { {"🦄"},{"BB"}},footer_pos="right"})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔═════════╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚═════}🦄BB{5:╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔═════════╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚═════}🦄BB{5:╝}{0: }|
+ |
+ ]]}
+ end
+ end)
+
+ it('border with title and footer', function()
+ local buf = meths.create_buf(false, false)
+ meths.buf_set_lines(buf, 0, -1, true, {' halloj! ',
+ ' BORDAA '})
+ local win = meths.open_win(buf, false, {
+ relative='editor', width=9, height=2, row=2, col=5, border="double",
+ title = "Left", title_pos = "left", footer = "Right", footer_pos = "right",
+ })
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔}{11:Left}{5:═════╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚════}{11:Right}{5:╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔}{11:Left}{5:═════╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚════}{11:Right}{5:╝}{0: }|
+ |
+ ]]}
+ end
+
+ meths.win_set_config(win, {title= "Center",title_pos="center",footer= "Center",footer_pos="center"})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔═}{11:Center}{5:══╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚═}{11:Center}{5:══╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔═}{11:Center}{5:══╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚═}{11:Center}{5:══╝}{0: }|
+ |
+ ]]}
+ end
+
+ meths.win_set_config(win, {title= "Right",title_pos="right",footer= "Left",footer_pos="left"})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔════}{11:Right}{5:╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚}{11:Left}{5:═════╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔════}{11:Right}{5:╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚}{11:Left}{5:═════╝}{0: }|
+ |
+ ]]}
+ end
+
+ command('hi B0 guibg=Red guifg=Black')
+ command('hi B1 guifg=White')
+ meths.win_set_config(win, {
+ title = {{"🦄"}, {"BB", {"B0", "B1"}}}, title_pos = "right",
+ footer= {{"🦄"}, {"BB", {"B0", "B1"}}}, footer_pos = "right",
+ })
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔═════}🦄{7:BB}{5:╗}|
+ {5:║}{1: halloj! }{5:║}|
+ {5:║}{1: BORDAA }{5:║}|
+ {5:╚═════}🦄{7:BB}{5:╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╔═════}🦄{7:BB}{5:╗}{0: }|
+ {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
+ {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
+ {0:~ }{5:╚═════}🦄{7:BB}{5:╝}{0: }|
+ |
+ ]]}
+ end
+ end)
+
it('terminates border on edge of viewport when window extends past viewport', function()
local buf = meths.create_buf(false, false)
- meths.open_win(buf, false, {relative='editor', width=40, height=7, row=0, col=0, border="single"})
+ meths.open_win(buf, false, {relative='editor', width=40, height=7, row=0, col=0, border="single", zindex=201})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -2046,10 +2670,10 @@ describe('float window', function()
{5:│}{2:~ }{5:│}|
{5:└────────────────────────────────────────┘}|
]], float_pos={
- [4] = { { id = 1001 }, "NW", 1, 0, 0, true }
+ [4] = { { id = 1001 }, "NW", 1, 0, 0, true, 201 }
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -2058,8 +2682,8 @@ describe('float window', function()
{5:│}{2:~ }{5:│}|
{5:│}{2:~ }{5:│}|
{5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
{5:└──────────────────────────────────────┘}|
- |
]]}
end
end)
@@ -2097,17 +2721,17 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:╔═════════╗}|
{5:║}{1:aaa aab }{5:║}|
{5:║}{1:abb acc }{5:║}|
{5:║}{1:^ }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 0, 5, true }
+ [4] = { { id = 1001 }, "NW", 1, 0, 5, true };
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -2150,23 +2774,23 @@ describe('float window', function()
{0:~ }|
## grid 3
{3:-- }{8:match 1 of 4} |
- ## grid 5
+ ## grid 4
{5:╔═════════╗}|
{5:║}{1:aaa aab }{5:║}|
{5:║}{1:abb acc }{5:║}|
{5:║}{1:acc^ }{5:║}|
{5:╚═════════╝}|
- ## grid 6
+ ## grid 5
{1: aaa }|
{1: aab }|
{1: abb }|
{13: acc }|
]], float_pos={
- [5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 },
- [6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 }
+ [4] = { { id = 1001 }, "NW", 1, 0, 5, true, 50 };
+ [5] = { { id = -1 }, "NW", 4, 4, 0, false, 100 };
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -2182,6 +2806,374 @@ describe('float window', function()
{3:-- }{8:match 1 of 4} |
]]}
end
+
+ feed '<esc>'
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:╔═════════╗}|
+ {5:║}{1:aaa aab }{5:║}|
+ {5:║}{1:abb acc }{5:║}|
+ {5:║}{1:ac^c }{5:║}|
+ {5:╚═════════╝}|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 0, 5, true };
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ {5:╔═════════╗} |
+ {0:~ }{5:║}{1:aaa aab }{5:║}{0: }|
+ {0:~ }{5:║}{1:abb acc }{5:║}{0: }|
+ {0:~ }{5:║}{1:ac^c }{5:║}{0: }|
+ {0:~ }{5:╚═════════╝}{0: }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ exec([[
+ nnoremenu Test.foo :
+ nnoremenu Test.bar :
+ nnoremenu Test.baz :
+ ]])
+ feed ':popup Test<CR>'
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ :popup Test |
+ ## grid 4
+ {5:╔═════════╗}|
+ {5:║}{1:aaa aab }{5:║}|
+ {5:║}{1:abb acc }{5:║}|
+ {5:║}{1:ac^c }{5:║}|
+ {5:╚═════════╝}|
+ ## grid 5
+ {1: foo }|
+ {1: bar }|
+ {1: baz }|
+ ]], float_pos={
+ [4] = { { id = 1001 }, "NW", 1, 0, 5, true };
+ [5] = { { id = -1 }, "NW", 4, 4, 2, false, 250 };
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ {5:╔═════════╗} |
+ {0:~ }{5:║}{1:aaa aab }{5:║}{0: }|
+ {0:~ }{5:║}{1:abb acc }{5:║}{0: }|
+ {0:~ }{5:║}{1:ac^c }{5:║}{0: }|
+ {0:~ }{5:╚═}{1: foo }{5:═══╝}{0: }|
+ {0:~ }{1: bar }{0: }|
+ {0:~ }{1: baz }{0: }|
+ {0:~ }|
+ {0:~ }|
+ :popup Test |
+ ]]}
+ end
+ end)
+
+ it('show ruler of current floating window', function()
+ command 'set ruler'
+ local buf = meths.create_buf(false, false)
+ meths.buf_set_lines(buf, 0, -1, true, {'aaa aab ',
+ 'abb acc '})
+ meths.open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5})
+ feed 'gg'
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ 1,1 All |
+ ## grid 4
+ {1:^aaa aab }|
+ {1:abb acc }|
+ {2:~ }|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ {1:^aaa aab } |
+ {0:~ }{1:abb acc }{0: }|
+ {0:~ }{2:~ }{0: }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ 1,1 All |
+ ]]}
+ end
+
+ feed 'w'
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ 1,5 All |
+ ## grid 4
+ {1:aaa ^aab }|
+ {1:abb acc }|
+ {2:~ }|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 4, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ {1:aaa ^aab } |
+ {0:~ }{1:abb acc }{0: }|
+ {0:~ }{2:~ }{0: }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ 1,5 All |
+ ]]}
+ end
+ end)
+
+ it("correct ruler position in current float with 'rulerformat' set", function()
+ command 'set ruler rulerformat=fish:<><'
+ meths.open_win(0, true, {relative='editor', width=9, height=3, row=0, col=5})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ fish:<>< |
+ ## grid 4
+ {1:^ }|
+ {2:~ }|
+ {2:~ }|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ {1:^ } |
+ {0:~ }{2:~ }{0: }|
+ {0:~ }{2:~ }{0: }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ fish:<>< |
+ ]]}
+ end
+ end)
+
+ it('does not show ruler of not-last current float during ins-completion', function()
+ screen:try_resize(50,9)
+ command 'set ruler showmode'
+ meths.open_win(0, false, {relative='editor', width=3, height=3, row=0, col=0})
+ meths.open_win(0, false, {relative='editor', width=3, height=3, row=0, col=5})
+ feed '<c-w>w'
+ neq('', meths.win_get_config(0).relative)
+ neq(funcs.winnr '$', funcs.winnr())
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [3:--------------------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ 0,0-1 All |
+ ## grid 4
+ {1: }|
+ {2:~ }|
+ {2:~ }|
+ ## grid 5
+ {1:^ }|
+ {2:~ }|
+ {2:~ }|
+ ]], float_pos={
+ [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 0, 0, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ {1: } {1:^ } |
+ {2:~ }{0: }{2:~ }{0: }|
+ {2:~ }{0: }{2:~ }{0: }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ 0,0-1 All |
+ ]]}
+ end
+ feed 'i<c-x>'
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [3:--------------------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {3:-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)} |
+ ## grid 4
+ {1: }|
+ {2:~ }|
+ {2:~ }|
+ ## grid 5
+ {1:^ }|
+ {2:~ }|
+ {2:~ }|
+ ]], float_pos={
+ [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 0, 0, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ {1: } {1:^ } |
+ {2:~ }{0: }{2:~ }{0: }|
+ {2:~ }{0: }{2:~ }{0: }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)} |
+ ]]}
+ end
end)
it('can have minimum size', function()
@@ -2208,10 +3200,10 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:x}|
]], float_pos={
- [5] = {{id = 1002}, "NW", 2, 0, 4, false}
+ [4] = {{id = 1001}, "NW", 2, 0, 4, false}
}}
else
screen:expect([[
@@ -2245,10 +3237,10 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:x}|
]], float_pos={
- [5] = {{id = 1002}, "NW", 2, 0, 15, false}
+ [4] = {{id = 1001}, "NW", 2, 0, 15, false}
}}
else
screen:expect([[
@@ -2296,6 +3288,154 @@ describe('float window', function()
end
end)
+ describe('no crash when rearranging windows', function()
+ local function test_rearrange_windows(cmd)
+ command('set laststatus=2')
+ screen:try_resize(40, 13)
+
+ command('args X1 X2 X3 X4 X5 X6')
+ command('sargument 2')
+ command('sargument 3')
+ local w3 = curwin()
+ command('sargument 4')
+ local w4 = curwin()
+ command('sargument 5')
+ command('sargument 6')
+
+ local float_opts = { relative = 'editor', row = 6, col = 0, width = 40, height = 1 }
+ meths.win_set_config(w3, float_opts)
+ meths.win_set_config(w4, float_opts)
+ command('wincmd =')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [8:----------------------------------------]|
+ [8:----------------------------------------]|
+ {4:X6 }|
+ [7:----------------------------------------]|
+ [7:----------------------------------------]|
+ {5:X5 }|
+ [4:----------------------------------------]|
+ [4:----------------------------------------]|
+ {5:X2 }|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {5:X1 }|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ |
+ {0:~ }|
+ ## grid 5
+ {1: }|
+ ## grid 6
+ {1: }|
+ ## grid 7
+ |
+ {0:~ }|
+ ## grid 8
+ ^ |
+ {0:~ }|
+ ]], float_pos={
+ [5] = {{id = 1002}, "NW", 1, 6, 0, true, 50};
+ [6] = {{id = 1003}, "NW", 1, 6, 0, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [5] = {win = {id = 1002}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [6] = {win = {id = 1003}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [7] = {win = {id = 1004}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [8] = {win = {id = 1005}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {4:X6 }|
+ |
+ {0:~ }|
+ {5:X5 }|
+ {1: }|
+ {0:~ }|
+ {5:X2 }|
+ |
+ {0:~ }|
+ {5:X1 }|
+ |
+ ]]}
+ end
+
+ command(cmd)
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ {4:X1 }|
+ [4:----------------------------------------]|
+ {5:X2 }|
+ [9:----------------------------------------]|
+ {5:X3 }|
+ [10:----------------------------------------]|
+ {5:X4 }|
+ [7:----------------------------------------]|
+ {5:X5 }|
+ [8:----------------------------------------]|
+ {5:X6 }|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ ## grid 3
+ |
+ ## grid 4
+ |
+ ## grid 7
+ |
+ ## grid 8
+ |
+ ## grid 9
+ |
+ ## grid 10
+ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [7] = {win = {id = 1004}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [8] = {win = {id = 1005}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [9] = {win = {id = 1006}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [10] = {win = {id = 1007}, topline = 0, botline = 1, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {4:X1 }|
+ |
+ {5:X2 }|
+ |
+ {5:X3 }|
+ |
+ {5:X4 }|
+ |
+ {5:X5 }|
+ |
+ {5:X6 }|
+ |
+ ]]}
+ end
+ end
+
+ it('using :unhide', function()
+ test_rearrange_windows('unhide')
+ end)
+
+ it('using :all', function()
+ test_rearrange_windows('all')
+ end)
+ end)
+
it('API has proper error messages', function()
local buf = meths.create_buf(false,false)
eq("Invalid key: 'bork'",
@@ -2496,7 +3636,6 @@ describe('float window', function()
]])
end
-
meths.win_set_config(win, {relative='win', win=oldwin, row=1, col=10, anchor='NW'})
if multigrid then
screen:expect{grid=[[
@@ -2618,7 +3757,8 @@ describe('float window', function()
curline = 0,
curcol = 3,
linecount = 2,
- win = { id = 1000 }
+ sum_scroll_delta = 0,
+ win = { id = 1000 },
},
[4] = {
topline = 0,
@@ -2626,6 +3766,7 @@ describe('float window', function()
curline = 0,
curcol = 3,
linecount = 2,
+ sum_scroll_delta = 0,
win = { id = 1001 }
},
[5] = {
@@ -2634,6 +3775,7 @@ describe('float window', function()
curline = 0,
curcol = 0,
linecount = 1,
+ sum_scroll_delta = 0,
win = { id = 1002 }
}
}}
@@ -2741,13 +3883,13 @@ describe('float window', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 6
+ ## grid 5
{5:╔═════════╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [6] = {{id = 1003}, "NW", 4, 1, 14, true}
+ [5] = {{id = 1002}, "NW", 4, 1, 14, true}
}}
else
screen:expect([[
@@ -2798,13 +3940,13 @@ describe('float window', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 6
+ ## grid 5
{5:╔═════════╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [6] = {{id = 1003}, "NE", 4, 0, 14, true}
+ [5] = {{id = 1002}, "NE", 4, 0, 14, true}
}}
else
screen:expect([[
@@ -2855,13 +3997,13 @@ describe('float window', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 6
+ ## grid 5
{5:╔═════════╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [6] = {{id = 1003}, "SE", 4, 1, 14, true}
+ [5] = {{id = 1002}, "SE", 4, 1, 14, true}
}}
else
screen:expect([[
@@ -2912,13 +4054,13 @@ describe('float window', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 6
+ ## grid 5
{5:╔═════════╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚═════════╝}|
]], float_pos={
- [6] = {{id = 1003}, "SW", 4, 0, 14, true}
+ [5] = {{id = 1002}, "SW", 4, 0, 14, true}
}}
else
screen:expect([[
@@ -2939,6 +4081,198 @@ describe('float window', function()
end
end)
+ it('anchored to another floating window updated in the same call #14735', function()
+ feed('i<CR><CR><CR><Esc>')
+
+ exec([[
+ let b1 = nvim_create_buf(v:true, v:false)
+ let b2 = nvim_create_buf(v:true, v:false)
+ let b3 = nvim_create_buf(v:true, v:false)
+ let b4 = nvim_create_buf(v:true, v:false)
+ let b5 = nvim_create_buf(v:true, v:false)
+ let b6 = nvim_create_buf(v:true, v:false)
+ let b7 = nvim_create_buf(v:true, v:false)
+ let b8 = nvim_create_buf(v:true, v:false)
+ call setbufline(b1, 1, '1')
+ call setbufline(b2, 1, '2')
+ call setbufline(b3, 1, '3')
+ call setbufline(b4, 1, '4')
+ call setbufline(b5, 1, '5')
+ call setbufline(b6, 1, '6')
+ call setbufline(b7, 1, '7')
+ call setbufline(b8, 1, '8')
+ let o1 = #{relative: 'editor', row: 1, col: 10, width: 5, height: 1}
+ let w1 = nvim_open_win(b1, v:false, o1)
+ let o2 = extendnew(o1, #{col: 30})
+ let w2 = nvim_open_win(b2, v:false, o2)
+ let o3 = extendnew(o1, #{relative: 'win', win: w1, anchor: 'NE', col: 0})
+ let w3 = nvim_open_win(b3, v:false, o3)
+ let o4 = extendnew(o3, #{win: w2})
+ let w4 = nvim_open_win(b4, v:false, o4)
+ let o5 = extendnew(o3, #{win: w3, anchor: 'SE', row: 0})
+ let w5 = nvim_open_win(b5, v:false, o5)
+ let o6 = extendnew(o5, #{win: w4})
+ let w6 = nvim_open_win(b6, v:false, o6)
+ let o7 = extendnew(o5, #{win: w5, anchor: 'SW', col: 5})
+ let w7 = nvim_open_win(b7, v:false, o7)
+ let o8 = extendnew(o7, #{win: w6})
+ let w8 = nvim_open_win(b8, v:false, o8)
+ ]])
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ |
+ |
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 5
+ {1:1 }|
+ ## grid 6
+ {1:2 }|
+ ## grid 7
+ {1:3 }|
+ ## grid 8
+ {1:4 }|
+ ## grid 9
+ {1:5 }|
+ ## grid 10
+ {1:6 }|
+ ## grid 11
+ {1:7 }|
+ ## grid 12
+ {1:8 }|
+ ]], float_pos={
+ [5] = {{id = 1002}, "NW", 1, 1, 10, true, 50};
+ [6] = {{id = 1003}, "NW", 1, 1, 30, true, 50};
+ [7] = {{id = 1004}, "NE", 5, 1, 0, true, 50};
+ [8] = {{id = 1005}, "NE", 6, 1, 0, true, 50};
+ [9] = {{id = 1006}, "SE", 7, 0, 0, true, 50};
+ [10] = {{id = 1007}, "SE", 8, 0, 0, true, 50};
+ [11] = {{id = 1008}, "SW", 9, 0, 5, true, 50};
+ [12] = {{id = 1009}, "SW", 10, 0, 5, true, 50};
+ }}
+ else
+ screen:expect([[
+ {1:7 } {1:8 } |
+ {1:5 } {1:1 } {1:6 } {1:2 } |
+ {1:3 } {1:4 } |
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+
+ -- Reconfigure in different directions
+ exec([[
+ let o1 = extendnew(o1, #{anchor: 'NW'})
+ call nvim_win_set_config(w8, o1)
+ let o2 = extendnew(o2, #{anchor: 'NW'})
+ call nvim_win_set_config(w4, o2)
+ let o3 = extendnew(o3, #{win: w8})
+ call nvim_win_set_config(w2, o3)
+ let o4 = extendnew(o4, #{win: w4})
+ call nvim_win_set_config(w1, o4)
+ let o5 = extendnew(o5, #{win: w2})
+ call nvim_win_set_config(w6, o5)
+ let o6 = extendnew(o6, #{win: w1})
+ call nvim_win_set_config(w3, o6)
+ let o7 = extendnew(o7, #{win: w6})
+ call nvim_win_set_config(w5, o7)
+ let o8 = extendnew(o8, #{win: w3})
+ call nvim_win_set_config(w7, o8)
+ ]])
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ |
+ |
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 5
+ {1:1 }|
+ ## grid 6
+ {1:2 }|
+ ## grid 7
+ {1:3 }|
+ ## grid 8
+ {1:4 }|
+ ## grid 9
+ {1:5 }|
+ ## grid 10
+ {1:6 }|
+ ## grid 11
+ {1:7 }|
+ ## grid 12
+ {1:8 }|
+ ]], float_pos={
+ [5] = {{id = 1002}, "NE", 8, 1, 0, true, 50};
+ [6] = {{id = 1003}, "NE", 12, 1, 0, true, 50};
+ [7] = {{id = 1004}, "SE", 5, 0, 0, true, 50};
+ [8] = {{id = 1005}, "NW", 1, 1, 30, true, 50};
+ [9] = {{id = 1006}, "SW", 10, 0, 5, true, 50};
+ [10] = {{id = 1007}, "SE", 6, 0, 0, true, 50};
+ [11] = {{id = 1008}, "SW", 7, 0, 5, true, 50};
+ [12] = {{id = 1009}, "NW", 1, 1, 10, true, 50};
+ }}
+ else
+ screen:expect([[
+ {1:5 } {1:7 } |
+ {1:6 } {1:8 } {1:3 } {1:4 } |
+ {1:2 } {1:1 } |
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+
+ -- Not clear how cycles should behave, but they should not hang or crash
+ exec([[
+ let o1 = extendnew(o1, #{relative: 'win', win: w7})
+ call nvim_win_set_config(w1, o1)
+ let o2 = extendnew(o2, #{relative: 'win', win: w8})
+ call nvim_win_set_config(w2, o2)
+ let o3 = extendnew(o3, #{win: w1})
+ call nvim_win_set_config(w3, o3)
+ let o4 = extendnew(o4, #{win: w2})
+ call nvim_win_set_config(w4, o4)
+ let o5 = extendnew(o5, #{win: w3})
+ call nvim_win_set_config(w5, o5)
+ let o6 = extendnew(o6, #{win: w4})
+ call nvim_win_set_config(w6, o6)
+ let o7 = extendnew(o7, #{win: w5})
+ call nvim_win_set_config(w7, o7)
+ let o8 = extendnew(o8, #{win: w6})
+ call nvim_win_set_config(w8, o8)
+ redraw
+ ]])
+ end)
+
it('can be placed relative text in a window', function()
screen:try_resize(30,5)
local firstwin = meths.get_current_win().id
@@ -2988,12 +4322,10 @@ describe('float window', function()
|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some info! }|
]], float_pos={
- [5] = { {
- id = 1002
- }, "NW", 2, 3, 2, true }
+ [4] = { { id = 1001 }, "NW", 2, 3, 2, true }
}}
else
screen:expect{grid=[[
@@ -3004,7 +4336,7 @@ describe('float window', function()
|
]]}
end
- eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW',
+ eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW', hide=false,
external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, meths.win_get_config(win))
feed('<c-e>')
@@ -3023,12 +4355,10 @@ describe('float window', function()
|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some info! }|
]], float_pos={
- [5] = { {
- id = 1002
- }, "NW", 2, 2, 2, true }
+ [4] = { { id = 1001 }, "NW", 2, 2, 2, true },
}}
else
screen:expect{grid=[[
@@ -3057,12 +4387,10 @@ describe('float window', function()
more text |
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some info! }|
]], float_pos={
- [5] = { {
- id = 1002
- }, "NW", 2, 1, 32, true }
+ [4] = { { id = 1001 }, "NW", 2, 1, 32, true }
}}
else
-- note: appears misaligned due to cursor
@@ -3101,12 +4429,10 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some info! }|
]], float_pos={
- [5] = { {
- id = 1002
- }, "NW", 2, 2, 7, true }
+ [4] = { { id = 1001 }, "NW", 2, 2, 7, true }
}}
else
screen:expect{grid=[[
@@ -3149,12 +4475,10 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some info! }|
]], float_pos={
- [5] = { {
- id = 1002
- }, "SW", 2, 1, 7, true }
+ [4] = { { id = 1001 }, "SW", 2, 1, 7, true }
}}
else
screen:expect{grid=[[
@@ -3176,15 +4500,15 @@ describe('float window', function()
if multigrid then
screen:expect{grid=[[
## grid 1
- [2:----]{5:│}[6:--------------------]|
- [2:----]{5:│}[6:--------------------]|
- [2:----]{5:│}[6:--------------------]|
- [2:----]{5:│}[6:--------------------]|
- [2:----]{5:│}[6:--------------------]|
- [2:----]{5:│}[6:--------------------]|
- [2:----]{5:│}[6:--------------------]|
- [2:----]{5:│}[6:--------------------]|
- [2:----]{5:│}[6:--------------------]|
+ [2:----]{5:│}[5:--------------------]|
+ [2:----]{5:│}[5:--------------------]|
+ [2:----]{5:│}[5:--------------------]|
+ [2:----]{5:│}[5:--------------------]|
+ [2:----]{5:│}[5:--------------------]|
+ [2:----]{5:│}[5:--------------------]|
+ [2:----]{5:│}[5:--------------------]|
+ [2:----]{5:│}[5:--------------------]|
+ [2:----]{5:│}[5:--------------------]|
[3:-------------------------]|
## grid 2
exam|
@@ -3198,9 +4522,9 @@ describe('float window', function()
the |
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some info! }|
- ## grid 6
+ ## grid 5
^ |
{0:~ }|
{0:~ }|
@@ -3211,9 +4535,7 @@ describe('float window', function()
{0:~ }|
{0:~ }|
]], float_pos={
- [5] = { {
- id = 1002
- }, "SW", 2, 8, 0, true }
+ [4] = { { id = 1001 }, "SW", 2, 8, 0, true }
}}
else
screen:expect{grid=[[
@@ -3257,12 +4579,10 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some info! }|
]], float_pos={
- [5] = { {
- id = 1002
- }, "NW", 2, 2, 5, true }
+ [4] = { { id = 1001 }, "NW", 2, 2, 5, true }
}}
else
screen:expect{grid=[[
@@ -3305,12 +4625,10 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some info! }|
]], float_pos={
- [5] = { {
- id = 1002
- }, "NW", 2, 3, 7, true }
+ [4] = { { id = 1001 }, "NW", 2, 3, 7, true }
}}
else
screen:expect{grid=[[
@@ -3353,12 +4671,10 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some info! }|
]], float_pos={
- [5] = { {
- id = 1002
- }, "NW", 2, 2, 0, true }
+ [4] = { { id = 1001 }, "NW", 2, 2, 0, true }
}}
else
screen:expect{grid=[[
@@ -3424,10 +4740,10 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:some floaty text }|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 3, 1, true}
+ [4] = {{id = 1001}, "NW", 1, 3, 1, true}
}}
else
screen:expect([[
@@ -3483,7 +4799,7 @@ describe('float window', function()
meths.buf_set_lines(buf, 0, -1, true, {'such', 'very', 'float'})
local win = meths.open_win(buf, false, {relative='editor', width=15, height=4, row=2, col=10})
local expected_pos = {
- [5]={{id=1002}, 'NW', 1, 2, 10, true},
+ [4]={{id=1001}, 'NW', 1, 2, 10, true},
}
if multigrid then
screen:expect{grid=[[
@@ -3504,7 +4820,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:such }|
{1:very }|
{1:float }|
@@ -3538,7 +4854,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:such }|
{1:very }|
{1:float }|
@@ -3568,7 +4884,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:such }|
{1:very }|
{1:float }|
@@ -3595,7 +4911,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:such }|
{1:very }|
{1:float }|
@@ -3620,7 +4936,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:such }|
{1:very }|
{1:^float }|
@@ -3628,9 +4944,9 @@ describe('float window', function()
]], float_pos=expected_pos}
else
screen:expect([[
- {1:very } |
- {0:~ }{1:^float }{0: }|
- |
+ {1:such } |
+ {0:~ }{1:very }{0: }|
+ ^ |
]])
end
@@ -3654,7 +4970,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:such }|
{1:very }|
{1:^float }|
@@ -3693,7 +5009,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -3730,7 +5046,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -3767,7 +5083,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -3804,7 +5120,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -3841,7 +5157,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -3878,7 +5194,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -3915,7 +5231,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -3952,7 +5268,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -3980,7 +5296,7 @@ describe('float window', function()
|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -4012,7 +5328,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -4162,8 +5478,8 @@ describe('float window', function()
describe('and completion', function()
before_each(function()
local buf = meths.create_buf(false,false)
- local win = meths.open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5})
- meths.win_set_option(win , 'winhl', 'Normal:ErrorMsg')
+ local win = meths.open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5}).id
+ meths.set_option_value('winhl', 'Normal:ErrorMsg', {win=win})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -4672,12 +5988,12 @@ describe('float window', function()
{13:aa }|
{1:word }|
{1:longtext }|
- ## grid 6
+ ## grid 5
{15:some info }|
{15:about item }|
]], float_pos={
[4] = {{id = -1}, "NW", 2, 1, 0, false, 100},
- [6] = {{id = 1002}, "NW", 2, 1, 12, true, 50},
+ [5] = {{id = 1001}, "NW", 2, 1, 12, true, 50},
}}
else
screen:expect([[
@@ -4713,11 +6029,11 @@ describe('float window', function()
{0:~ }|
## grid 3
{3:-- INSERT --} |
- ## grid 6
+ ## grid 5
{15:some info }|
{15:about item }|
]], float_pos={
- [6] = {{id = 1002}, "NW", 2, 1, 12, true},
+ [5] = {{id = 1001}, "NW", 2, 1, 12, true},
}}
else
screen:expect([[
@@ -4840,6 +6156,53 @@ describe('float window', function()
end)
end)
+ it("can use Normal as background", function()
+ local buf = meths.create_buf(false,false)
+ meths.buf_set_lines(buf,0,-1,true,{"here", "float"})
+ local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
+ meths.set_option_value('winhl', 'Normal:Normal', {win=win})
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ here |
+ float |
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }here {0: }|
+ {0:~ }float {0: }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ end
+ end)
+
describe("handles :wincmd", function()
local win
local expected_pos
@@ -5153,7 +6516,7 @@ describe('float window', function()
end
if multigrid then
- meths.input_mouse('left', 'press', '', 1, 0, 0)
+ meths.input_mouse('left', 'press', '', 2, 0, 0)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -5232,7 +6595,7 @@ describe('float window', function()
end
if multigrid then
- meths.input_mouse('left', 'press', '', 1, 0, 0)
+ meths.input_mouse('left', 'press', '', 2, 0, 0)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -7142,18 +8505,18 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:foo }|
{1:bar }|
{1:baz }|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 2, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}}
- meths.input_mouse('left', 'press', '', 5, 0, 0)
+ meths.input_mouse('left', 'press', '', 4, 0, 0)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -7172,18 +8535,18 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{1:^foo }|
{1:bar }|
{1:baz }|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 2, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}}
- meths.input_mouse('left', 'drag', '', 5, 1, 2)
+ meths.input_mouse('left', 'drag', '', 4, 1, 2)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -7202,15 +8565,15 @@ describe('float window', function()
{0:~ }|
## grid 3
{3:-- VISUAL --} |
- ## grid 5
+ ## grid 4
{27:foo}{1: }|
{27:ba}{1:^r }|
{1:baz }|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 2, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -7270,20 +8633,20 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:┌────────────────────┐}|
{5:│}{1:foo }{5:│}|
{5:│}{1:bar }{5:│}|
{5:│}{1:baz }{5:│}|
{5:└────────────────────┘}|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}}
- meths.input_mouse('left', 'press', '', 5, 1, 1)
+ meths.input_mouse('left', 'press', '', 4, 1, 1)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -7302,20 +8665,20 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:┌────────────────────┐}|
{5:│}{1:^foo }{5:│}|
{5:│}{1:bar }{5:│}|
{5:│}{1:baz }{5:│}|
{5:└────────────────────┘}|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}}
- meths.input_mouse('left', 'drag', '', 5, 2, 3)
+ meths.input_mouse('left', 'drag', '', 4, 2, 3)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -7334,17 +8697,17 @@ describe('float window', function()
{0:~ }|
## grid 3
{3:-- VISUAL --} |
- ## grid 5
+ ## grid 4
{5:┌────────────────────┐}|
{5:│}{27:foo}{1: }{5:│}|
{5:│}{27:ba}{1:^r }{5:│}|
{5:│}{1:baz }{5:│}|
{5:└────────────────────┘}|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -7385,7 +8748,7 @@ describe('float window', function()
local buf = meths.create_buf(false,false)
meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'})
local float_win = meths.open_win(buf, false, {relative='editor', width=20, height=4, row=1, col=5})
- meths.win_set_option(float_win, 'winbar', 'floaty bar')
+ meths.set_option_value('winbar', 'floaty bar', {win=float_win.id})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -7405,19 +8768,19 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{3:floaty bar }|
{1:foo }|
{1:bar }|
{1:baz }|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 1, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 1, 5, true, 50};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}}
- meths.input_mouse('left', 'press', '', 5, 1, 0)
+ meths.input_mouse('left', 'press', '', 4, 1, 0)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -7436,19 +8799,19 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{3:floaty bar }|
{1:^foo }|
{1:bar }|
{1:baz }|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 1, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 1, 5, true, 50};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}}
- meths.input_mouse('left', 'drag', '', 5, 2, 2)
+ meths.input_mouse('left', 'drag', '', 4, 2, 2)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -7467,16 +8830,16 @@ describe('float window', function()
{0:~ }|
## grid 3
{3:-- VISUAL --} |
- ## grid 5
+ ## grid 4
{3:floaty bar }|
{27:foo}{1: }|
{27:ba}{1:^r }|
{1:baz }|
]], float_pos={
- [5] = {{id = 1002}, "NW", 1, 1, 5, true, 50};
+ [4] = {{id = 1001}, "NW", 1, 1, 5, true, 50};
}, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
- [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -7521,11 +8884,11 @@ describe('float window', function()
if multigrid then
screen:expect([[
## grid 1
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
{5:[No Name] }{4:[No Name] [+] }|
[3:----------------------------------------]|
## grid 2
@@ -7536,7 +8899,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
^foo |
bar |
baz |
@@ -7544,14 +8907,14 @@ describe('float window', function()
{0:~ }|
]])
- meths.input_mouse('left', 'press', '', 5, 2, 2)
+ meths.input_mouse('left', 'press', '', 4, 2, 2)
screen:expect([[
## grid 1
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
{5:[No Name] }{4:[No Name] [+] }|
[3:----------------------------------------]|
## grid 2
@@ -7562,7 +8925,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
foo |
bar |
ba^z |
@@ -7570,14 +8933,14 @@ describe('float window', function()
{0:~ }|
]])
- meths.input_mouse('left', 'drag', '', 5, 1, 1)
+ meths.input_mouse('left', 'drag', '', 4, 1, 1)
screen:expect([[
## grid 1
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
- [2:-------------------]{5:│}[5:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
+ [2:-------------------]{5:│}[4:--------------------]|
{5:[No Name] }{4:[No Name] [+] }|
[3:----------------------------------------]|
## grid 2
@@ -7588,7 +8951,7 @@ describe('float window', function()
{0:~ }|
## grid 3
{3:-- VISUAL --} |
- ## grid 5
+ ## grid 4
foo |
b^a{27:r} |
{27:baz} |
@@ -7630,6 +8993,186 @@ describe('float window', function()
end
end)
+ it('left click sets correct curswant in float window with border', function()
+ local buf = meths.create_buf(false,false)
+ meths.buf_set_lines(buf, 0, -1, true, {'', '', ''})
+ meths.open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:┌────────────────────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{1: }{5:│}|
+ {5:│}{1: }{5:│}|
+ {5:└────────────────────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ {5:┌────────────────────┐} |
+ {0:~ }{5:│}{1: }{5:│}{0: }|
+ {0:~ }{5:│}{1: }{5:│}{0: }|
+ {0:~ }{5:│}{1: }{5:│}{0: }|
+ {0:~ }{5:└────────────────────┘}{0: }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 3, 1)
+ else
+ meths.input_mouse('left', 'press', '', 0, 3, 6)
+ end
+ eq({0, 3, 1, 0, 1}, funcs.getcurpos())
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 3, 2)
+ else
+ meths.input_mouse('left', 'press', '', 0, 3, 7)
+ end
+ eq({0, 3, 1, 0, 2}, funcs.getcurpos())
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 3, 10)
+ else
+ meths.input_mouse('left', 'press', '', 0, 3, 15)
+ end
+ eq({0, 3, 1, 0, 10}, funcs.getcurpos())
+
+ command('setlocal foldcolumn=1')
+ feed('zfkgg')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:┌────────────────────┐}|
+ {5:│}{19: }{1:^ }{5:│}|
+ {5:│}{19:+}{28:+-- 2 lines: ·····}{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└────────────────────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 4, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ {5:┌────────────────────┐} |
+ {0:~ }{5:│}{19: }{1:^ }{5:│}{0: }|
+ {0:~ }{5:│}{19:+}{28:+-- 2 lines: ·····}{5:│}{0: }|
+ {0:~ }{5:│}{2:~ }{5:│}{0: }|
+ {0:~ }{5:└────────────────────┘}{0: }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 2, 1)
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:┌────────────────────┐}|
+ {5:│}{19: }{1:^ }{5:│}|
+ {5:│}{19:-}{1: }{5:│}|
+ {5:│}{19:│}{1: }{5:│}|
+ {5:└────────────────────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
+ }}
+ else
+ meths.input_mouse('left', 'press', '', 0, 2, 6)
+ screen:expect{grid=[[
+ {5:┌────────────────────┐} |
+ {0:~ }{5:│}{19: }{1:^ }{5:│}{0: }|
+ {0:~ }{5:│}{19:-}{1: }{5:│}{0: }|
+ {0:~ }{5:│}{19:│}{1: }{5:│}{0: }|
+ {0:~ }{5:└────────────────────┘}{0: }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 2, 2)
+ else
+ meths.input_mouse('left', 'press', '', 0, 2, 7)
+ end
+ eq({0, 2, 1, 0, 1}, funcs.getcurpos())
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 2, 3)
+ else
+ meths.input_mouse('left', 'press', '', 0, 2, 8)
+ end
+ eq({0, 2, 1, 0, 2}, funcs.getcurpos())
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 2, 11)
+ else
+ meths.input_mouse('left', 'press', '', 0, 2, 16)
+ end
+ eq({0, 2, 1, 0, 10}, funcs.getcurpos())
+ end)
+
it("'winblend' option", function()
screen:try_resize(50,9)
screen:set_default_attr_ids({
@@ -7641,10 +9184,23 @@ describe('float window', function()
[6] = {foreground = tonumber('0x332533'), background = tonumber('0xfff1ff')},
[7] = {background = tonumber('0xffcfff'), bold = true, foreground = tonumber('0x0000d8')},
[8] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1},
- [9] = {background = Screen.colors.LightMagenta, blend=30},
- [10] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend=0},
- [11] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend=80},
- [12] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1, blend=30},
+ [9] = {background = Screen.colors.LightMagenta, blend = 30},
+ [10] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend = 0},
+ [11] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend = 80},
+ [12] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1, blend = 30},
+ [13] = {background = Screen.colors.LightGray, blend = 30},
+ [14] = {foreground = Screen.colors.Grey0, background = Screen.colors.Grey88},
+ [15] = {foreground = tonumber('0x939393'), background = Screen.colors.Grey88},
+ [16] = {background = Screen.colors.Grey90};
+ [17] = {blend = 100};
+ [18] = {background = Screen.colors.LightMagenta, blend = 100};
+ [19] = {background = Screen.colors.LightMagenta, bold = true, blend = 100, foreground = Screen.colors.Blue1};
+ [20] = {background = Screen.colors.White, foreground = Screen.colors.Gray0};
+ [21] = {background = Screen.colors.White, bold = true, foreground = tonumber('0x00007f')};
+ [22] = {background = Screen.colors.Gray90, foreground = Screen.colors.Gray0};
+ [23] = {blend = 100, bold = true, foreground = Screen.colors.Magenta};
+ [24] = {foreground = tonumber('0x7f007f'), bold = true, background = Screen.colors.White};
+ [25] = {foreground = tonumber('0x7f007f'), bold = true, background = Screen.colors.Grey90};
})
insert([[
Lorem ipsum dolor sit amet, consectetur
@@ -7684,11 +9240,11 @@ describe('float window', function()
laborum^. |
## grid 3
|
- ## grid 5
+ ## grid 4
{1:test }|
{1: }|
{1:popup text }|
- ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}}
+ ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}}
else
screen:expect([[
Ut enim ad minim veniam, quis nostrud |
@@ -7703,7 +9259,7 @@ describe('float window', function()
]])
end
- meths.win_set_option(win, "winblend", 30)
+ meths.set_option_value("winblend", 30, {win=win.id})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -7727,11 +9283,11 @@ describe('float window', function()
laborum^. |
## grid 3
|
- ## grid 5
+ ## grid 4
{9:test }|
{9: }|
{9:popup text }|
- ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}, unchanged=true}
+ ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}, unchanged=true}
else
screen:expect([[
Ut enim ad minim veniam, quis nostrud |
@@ -7746,6 +9302,58 @@ describe('float window', function()
]])
end
+ -- Check that 'winblend' works with NormalNC highlight
+ meths.set_option_value('winhighlight', 'NormalNC:Visual', {win = win})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [3:--------------------------------------------------]|
+ ## grid 2
+ 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^. |
+ ## grid 3
+ |
+ ## grid 4
+ {13:test }|
+ {13: }|
+ {13:popup text }|
+ ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}}
+ else
+ screen:expect([[
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea co{14:test}{15:o consequat}. Duis aute irure dolor in |
+ repre{15:henderit in vol}uptate velit esse cillum |
+ dolor{14:popup}{15:fugi}{14:text}{15:ul}la pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ laborum^. |
+ |
+ ]])
+ end
+
+ -- Also test with global NormalNC highlight
+ exec_lua([[
+ vim.api.nvim_set_option_value('winhighlight', '', {win = ...})
+ vim.api.nvim_set_hl(0, 'NormalNC', {link = 'Visual'})
+ ]], win)
+ screen:expect_unchanged()
+ command('hi clear NormalNC')
+
command('hi SpecialRegion guifg=Red blend=0')
meths.buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1)
if multigrid then
@@ -7771,11 +9379,11 @@ describe('float window', function()
laborum^. |
## grid 3
|
- ## grid 5
+ ## grid 4
{9:test }|
{9: }|
{10:popup text}{9: }|
- ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}}
+ ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}}
else
screen:expect([[
Ut enim ad minim veniam, quis nostrud |
@@ -7814,11 +9422,11 @@ describe('float window', function()
laborum^. |
## grid 3
|
- ## grid 5
+ ## grid 4
{9:test }|
{9: }|
{11:popup text}{9: }|
- ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}, unchanged=true}
+ ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}, unchanged=true}
else
screen:expect([[
Ut enim ad minim veniam, quis nostrud |
@@ -7835,7 +9443,7 @@ describe('float window', function()
-- Test scrolling by mouse
if multigrid then
- meths.input_mouse('wheel', 'down', '', 5, 2, 2)
+ meths.input_mouse('wheel', 'down', '', 4, 2, 2)
screen:expect{grid=[[
## grid 1
[2:--------------------------------------------------]|
@@ -7858,11 +9466,11 @@ describe('float window', function()
laborum^. |
## grid 3
|
- ## grid 5
+ ## grid 4
{11:popup text}{9: }|
{12:~ }|
{12:~ }|
- ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}}
+ ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}}
else
meths.input_mouse('wheel', 'down', '', 0, 4, 7)
screen:expect([[
@@ -7877,6 +9485,56 @@ describe('float window', function()
|
]])
end
+
+ -- Check that 'winblend' applies to border/title/footer
+ meths.win_set_config(win, {border='single', title='Title', footer='Footer'})
+ meths.set_option_value('winblend', 100, {win=win.id})
+ meths.set_option_value("cursorline", true, {win=0})
+ command('hi clear VertSplit')
+ feed('k0')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [3:--------------------------------------------------]|
+ ## grid 2
+ 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 |
+ {16:^qui officia deserunt mollit anim id est }|
+ laborum. |
+ ## grid 3
+ |
+ ## grid 4
+ {17:┌}{23:Title}{17:──────────┐}|
+ {17:│}{11:popup text}{18: }{17:│}|
+ {17:│}{19:~ }{17:│}|
+ {17:│}{19:~ }{17:│}|
+ {17:└}{23:Footer}{17:─────────┘}|
+ ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}}
+ else
+ screen:expect([[
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea co{20:┌}{24:Title}{20:──────────┐}Duis aute irure dolor in |
+ repre{20:│}{5:popup}{6:it i}{5:text}{20:lu│}tate velit esse cillum |
+ dolor{20:│}{21:~}{20:eu fugiat null│} pariatur. Excepteur sint |
+ occae{20:│}{21:~}{20:t cupidatat no│} proident, sunt in culpa |
+ {16:^qui o}{22:└}{25:Footer}{22:─────────┘}{16:ollit anim id est }|
+ laborum. |
+ |
+ ]])
+ end
end)
it('can overlap doublewidth chars', function()
@@ -7884,6 +9542,7 @@ describe('float window', function()
# TODO: 测试字典信息的准确性
# FIXME: 测试字典信息的准确性]])
local buf = meths.create_buf(false,false)
+ meths.buf_set_lines(buf, 0, -1, true, {'口', '口'})
local win = meths.open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'})
if multigrid then
screen:expect{grid=[[
@@ -7905,14 +9564,14 @@ describe('float window', function()
## grid 3
|
## grid 4
- {1: }|
- {1: }|
+ {1:口 }|
+ {1:口 }|
{1: }|
]], float_pos={ [4] = { { id = 1001 }, "NW", 1, 0, 11, true } }}
else
screen:expect([[
- # TODO: 测 {1: }信息的准确性 |
- # FIXME: 测{1: } 信息的准确^性 |
+ # TODO: 测 {1:口 }信息的准确性 |
+ # FIXME: 测{1:口 } 信息的准确^性 |
{0:~ }{1: }{0: }|
{0:~ }|
{0:~ }|
@@ -7959,7 +9618,7 @@ describe('float window', function()
-- at least. Also check invisible EndOfBuffer region blends correctly.
meths.buf_set_lines(buf, 0, -1, true, {" x x x xx", " x x x x"})
win = meths.open_win(buf, false, {relative='editor', width=12, height=3, row=0, col=11, style='minimal'})
- meths.win_set_option(win, 'winblend', 30)
+ meths.set_option_value('winblend', 30, {win=win.id})
screen:set_default_attr_ids({
[1] = {foreground = tonumber('0xb282b2'), background = tonumber('0xffcfff')},
[2] = {foreground = Screen.colors.Grey0, background = tonumber('0xffcfff')},
@@ -7986,14 +9645,12 @@ describe('float window', function()
{3:~ }|
## grid 3
|
- ## grid 6
+ ## grid 5
{5: x x x xx}|
{5: x x x x}|
{5: }|
]], float_pos={
- [6] = { {
- id = 1003
- }, "NW", 1, 0, 11, true }
+ [5] = { { id = 1002 }, "NW", 1, 0, 11, true }
}}
else
screen:expect([[
@@ -8027,14 +9684,12 @@ describe('float window', function()
{3:~ }|
## grid 3
|
- ## grid 6
+ ## grid 5
{5: x x x xx}|
{5: x x x x}|
{5: }|
]], float_pos={
- [6] = { {
- id = 1003
- }, "NW", 1, 0, 12, true }
+ [5] = { { id = 1002 }, "NW", 1, 0, 12, true }
}}
else
screen:expect([[
@@ -8096,11 +9751,11 @@ describe('float window', function()
{1:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{2:^long }|
{2:longer }|
{2:longest}|
- ## grid 6
+ ## grid 5
{2:---------}|
{2:- -}|
{2:- -}|
@@ -8110,11 +9765,11 @@ describe('float window', function()
[1] = {foreground = Screen.colors.Blue1, bold = true};
[2] = {background = Screen.colors.LightMagenta};
}, float_pos={
+ [4] = { {
+ id = 1001
+ }, "NW", 1, 1, 1, true },
[5] = { {
id = 1002
- }, "NW", 1, 1, 1, true },
- [6] = { {
- id = 1003
}, "NW", 1, 0, 0, true }
}}
else
@@ -8164,11 +9819,11 @@ describe('float window', function()
{1:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{2:^l}|
{2:o}|
{2:n}|
- ## grid 6
+ ## grid 5
{2:---}|
{2:- -}|
{2:- -}|
@@ -8178,12 +9833,8 @@ describe('float window', function()
[1] = {foreground = Screen.colors.Blue1, bold = true};
[2] = {background = Screen.colors.LightMagenta};
}, float_pos={
- [5] = { {
- id = 1002
- }, "NW", 1, 1, 1, true },
- [6] = { {
- id = 1003
- }, "NW", 1, 0, 0, true }
+ [4] = { { id = 1001 }, "NW", 1, 1, 1, true },
+ [5] = { { id = 1002 }, "NW", 1, 0, 0, true }
}}
else
screen:expect([[
@@ -8201,7 +9852,7 @@ describe('float window', function()
it("correctly orders multiple opened floats (current last)", function()
local buf = meths.create_buf(false,false)
local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
- meths.win_set_option(win, "winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg")
+ meths.set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id})
if multigrid then
screen:expect{grid=[[
@@ -8228,8 +9879,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, linecount = 1};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8246,10 +9897,10 @@ describe('float window', function()
exec_lua [[
local buf = vim.api.nvim_create_buf(false,false)
local win = vim.api.nvim_open_win(buf, false, {relative='editor', width=16, height=2, row=3, col=8})
- vim.api.nvim_win_set_option(win, "winhl", "EndOfBuffer:Normal")
+ vim.wo[win].winhl = "EndOfBuffer:Normal"
buf = vim.api.nvim_create_buf(false,false)
win = vim.api.nvim_open_win(buf, true, {relative='editor', width=12, height=2, row=4, col=10})
- vim.api.nvim_win_set_option(win, "winhl", "Normal:Search,EndOfBuffer:Search")
+ vim.wo[win].winhl = "Normal:Search,EndOfBuffer:Search"
]]
if multigrid then
@@ -8285,10 +9936,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, 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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
+ [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8306,7 +9957,7 @@ describe('float window', function()
it("correctly orders multiple opened floats (non-current last)", function()
local buf = meths.create_buf(false,false)
local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
- meths.win_set_option(win, "winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg")
+ meths.set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id})
if multigrid then
screen:expect{grid=[[
@@ -8333,8 +9984,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, linecount = 1};
- [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8351,10 +10002,10 @@ describe('float window', function()
exec_lua [[
local buf = vim.api.nvim_create_buf(false,false)
local win = vim.api.nvim_open_win(buf, true, {relative='editor', width=12, height=2, row=4, col=10})
- vim.api.nvim_win_set_option(win, "winhl", "Normal:Search,EndOfBuffer:Search")
+ vim.wo[win].winhl = "Normal:Search,EndOfBuffer:Search"
buf = vim.api.nvim_create_buf(false,false)
win = vim.api.nvim_open_win(buf, false, {relative='editor', width=16, height=2, row=3, col=8})
- vim.api.nvim_win_set_option(win, "winhl", "EndOfBuffer:Normal")
+ vim.wo[win].winhl = "EndOfBuffer:Normal"
]]
if multigrid then
@@ -8390,10 +10041,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, 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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8411,11 +10062,11 @@ describe('float window', function()
it('can use z-index', function()
local buf = meths.create_buf(false,false)
local win1 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=1, col=5, zindex=30})
- meths.win_set_option(win1, "winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg")
+ meths.set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win1.id})
local win2 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=6, zindex=50})
- meths.win_set_option(win2, "winhl", "Normal:Search,EndOfBuffer:Search")
+ meths.set_option_value("winhl", "Normal:Search,EndOfBuffer:Search", {win=win2.id})
local win3 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=3, col=7, zindex=40})
- meths.win_set_option(win3, "winhl", "Normal:Question,EndOfBuffer:Question")
+ meths.set_option_value("winhl", "Normal:Question,EndOfBuffer:Question", {win=win3.id})
if multigrid then
screen:expect{grid=[[
@@ -8453,10 +10104,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, 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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8474,7 +10125,7 @@ describe('float window', function()
it('can use winbar', function()
local buf = meths.create_buf(false,false)
local win1 = meths.open_win(buf, false, {relative='editor', width=15, height=3, row=1, col=5})
- meths.win_set_option(win1, 'winbar', 'floaty bar')
+ meths.set_option_value('winbar', 'floaty bar', {win=win1.id})
if multigrid then
screen:expect{grid=[[
@@ -8502,8 +10153,8 @@ describe('float window', function()
]], float_pos={
[4] = {{id = 1001}, "NW", 1, 1, 5, true, 50};
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8549,8 +10200,8 @@ describe('float window', function()
]], float_pos={
[4] = {{id = 1001}, "NW", 1, 0, 4, true, 50};
}, win_viewport={
- [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};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8594,7 +10245,7 @@ describe('float window', function()
{0:~ }|
{0:~ }|
## grid 3
- ## grid 5
+ ## grid 4
{5:┌────────────────────────────────────────┐}|
{5:│}{1: }{5:│}|
{5:│}{1: }{5:│}|
@@ -8602,10 +10253,10 @@ describe('float window', function()
{5:│}{1: }{5:│}|
{5:└────────────────────────────────────────┘}|
]], float_pos={
- [5] = {{id = 1002}, "SW", 1, 9, 0, true, 50};
+ [4] = {{id = 1001}, "SW", 1, 9, 0, true, 50};
}, win_viewport={
- [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 = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8650,16 +10301,16 @@ describe('float window', function()
{0:~ }|
{0:~ }|
## grid 3
- ## grid 5
+ ## grid 4
{5:┌────────────────────────────────────────┐}|
{5:│}{1: }{5:│}|
{5:│}{1: }{5:│}|
{5:└────────────────────────────────────────┘}|
]], float_pos={
- [5] = {{id = 1002}, "SW", 1, 9, 0, true, 50};
+ [4] = {{id = 1001}, "SW", 1, 9, 0, true, 50};
}, win_viewport={
- [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 = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8701,7 +10352,7 @@ describe('float window', function()
{0:~ }|
## grid 3
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8746,7 +10397,7 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:┌────────────────────────────────────────┐}|
{5:│}{1: }{5:│}|
{5:│}{1: }{5:│}|
@@ -8754,10 +10405,10 @@ describe('float window', function()
{5:│}{1: }{5:│}|
{5:└────────────────────────────────────────┘}|
]], float_pos={
- [5] = {{id = 1002}, "SW", 1, 8, 0, true, 50};
+ [4] = {{id = 1001}, "SW", 1, 8, 0, true, 50};
}, win_viewport={
- [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 = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8806,7 +10457,7 @@ describe('float window', function()
## grid 3
|
{8:Press ENTER or type command to continue}^ |
- ## grid 5
+ ## grid 4
{5:┌────────────────────────────────────────┐}|
{5:│}{1: }{5:│}|
{5:│}{1: }{5:│}|
@@ -8814,10 +10465,10 @@ describe('float window', function()
{5:│}{1: }{5:│}|
{5:└────────────────────────────────────────┘}|
]], float_pos={
- [5] = {{id = 1002}, "SW", 1, 8, 0, true, 50};
+ [4] = {{id = 1001}, "SW", 1, 8, 0, true, 50};
}, win_viewport={
- [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 = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8857,16 +10508,16 @@ describe('float window', function()
{0:~ }|
## grid 3
|
- ## grid 5
+ ## grid 4
{5:┌────────────────────────────────────────┐}|
{5:│}{1: }{5:│}|
{5:│}{1: }{5:│}|
{5:└────────────────────────────────────────┘}|
]], float_pos={
- [5] = {{id = 1002}, "SW", 1, 8, 0, true, 50};
+ [4] = {{id = 1001}, "SW", 1, 8, 0, true, 50};
}, win_viewport={
- [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 = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
@@ -8907,9 +10558,8 @@ describe('float window', function()
## grid 3
|
]], win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}}
-
else
screen:expect{grid=[[
^ |
@@ -8952,6 +10602,696 @@ describe('float window', function()
test_float_move_close('autocmd BufWinLeave * ++once redraw')
end)
end)
+
+ it(':sleep cursor placement #22639', function()
+ local float_opts = {relative = 'editor', row = 1, col = 1, width = 4, height = 3}
+ local win = meths.open_win(meths.create_buf(false, false), true, float_opts)
+ feed('iab<CR>cd<Esc>')
+ feed(':sleep 100')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ :sleep 100^ |
+ ## grid 4
+ {1:ab }|
+ {1:cd }|
+ {2:~ }|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ |
+ {0:~}{1:ab }{0: }|
+ {0:~}{1:cd }{0: }|
+ {0:~}{2:~ }{0: }|
+ {0:~ }|
+ {0:~ }|
+ :sleep 100^ |
+ ]]}
+ end
+
+ feed('<CR>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ :sleep 100 |
+ ## grid 4
+ {1:ab }|
+ {1:c^d }|
+ {2:~ }|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ |
+ {0:~}{1:ab }{0: }|
+ {0:~}{1:c^d }{0: }|
+ {0:~}{2:~ }{0: }|
+ {0:~ }|
+ {0:~ }|
+ :sleep 100 |
+ ]]}
+ end
+ feed('<C-C>')
+ screen:expect_unchanged()
+
+ meths.win_set_config(win, {border = 'single'})
+ feed(':sleep 100')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ :sleep 100^ |
+ ## grid 4
+ {5:┌────┐}|
+ {5:│}{1:ab }{5:│}|
+ {5:│}{1:cd }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ |
+ {0:~}{5:┌────┐}{0: }|
+ {0:~}{5:│}{1:ab }{5:│}{0: }|
+ {0:~}{5:│}{1:cd }{5:│}{0: }|
+ {0:~}{5:│}{2:~ }{5:│}{0: }|
+ {0:~}{5:└────┘}{0: }|
+ :sleep 100^ |
+ ]]}
+ end
+
+ feed('<CR>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ :sleep 100 |
+ ## grid 4
+ {5:┌────┐}|
+ {5:│}{1:ab }{5:│}|
+ {5:│}{1:c^d }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ |
+ {0:~}{5:┌────┐}{0: }|
+ {0:~}{5:│}{1:ab }{5:│}{0: }|
+ {0:~}{5:│}{1:c^d }{5:│}{0: }|
+ {0:~}{5:│}{2:~ }{5:│}{0: }|
+ {0:~}{5:└────┘}{0: }|
+ :sleep 100 |
+ ]]}
+ end
+ feed('<C-C>')
+ screen:expect_unchanged()
+
+ command('setlocal winbar=foo')
+ feed(':sleep 100')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ :sleep 100^ |
+ ## grid 4
+ {5:┌────┐}|
+ {5:│}{3:foo }{5:│}|
+ {5:│}{1:ab }{5:│}|
+ {5:│}{1:cd }{5:│}|
+ {5:└────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ |
+ {0:~}{5:┌────┐}{0: }|
+ {0:~}{5:│}{3:foo }{5:│}{0: }|
+ {0:~}{5:│}{1:ab }{5:│}{0: }|
+ {0:~}{5:│}{1:cd }{5:│}{0: }|
+ {0:~}{5:└────┘}{0: }|
+ :sleep 100^ |
+ ]]}
+ end
+
+ feed('<CR>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ :sleep 100 |
+ ## grid 4
+ {5:┌────┐}|
+ {5:│}{3:foo }{5:│}|
+ {5:│}{1:ab }{5:│}|
+ {5:│}{1:c^d }{5:│}|
+ {5:└────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ |
+ {0:~}{5:┌────┐}{0: }|
+ {0:~}{5:│}{3:foo }{5:│}{0: }|
+ {0:~}{5:│}{1:ab }{5:│}{0: }|
+ {0:~}{5:│}{1:c^d }{5:│}{0: }|
+ {0:~}{5:└────┘}{0: }|
+ :sleep 100 |
+ ]]}
+ end
+ feed('<C-C>')
+ screen:expect_unchanged()
+ end)
+
+ it('with rightleft and border #22640', function()
+ local float_opts = {relative='editor', width=5, height=3, row=1, col=1, border='single'}
+ meths.open_win(meths.create_buf(false, false), true, float_opts)
+ command('setlocal rightleft')
+ feed('iabc<CR>def<Esc>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:┌─────┐}|
+ {5:│}{1: cba}{5:│}|
+ {5:│}{1: ^fed}{5:│}|
+ {5:│}{2: ~}{5:│}|
+ {5:└─────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 1, 1, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 2, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ |
+ {0:~}{5:┌─────┐}{0: }|
+ {0:~}{5:│}{1: cba}{5:│}{0: }|
+ {0:~}{5:│}{1: ^fed}{5:│}{0: }|
+ {0:~}{5:│}{2: ~}{5:│}{0: }|
+ {0:~}{5:└─────┘}{0: }|
+ |
+ ]]}
+ end
+ end)
+
+ it('float window with hide option', function()
+ local buf = meths.create_buf(false,false)
+ local win = meths.open_win(buf, false, {relative='editor', width=10, height=2, row=2, col=5, hide = true})
+ local expected_pos = {
+ [4]={{id=1001}, 'NW', 1, 2, 5, true},
+ }
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+
+ ## grid 4 (hidden)
+ {1: }|
+ {2:~ }|
+ ]], float_pos = {}}
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+
+ meths.win_set_config(win, {hide = false})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+
+ ## grid 4
+ {1: }|
+ {2:~ }|
+ ]], float_pos = expected_pos}
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }{1: }{0: }|
+ {0:~ }{2:~ }{0: }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+
+ meths.win_set_config(win, {hide=true})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+
+ ## grid 4 (hidden)
+ {1: }|
+ {2:~ }|
+ ]], float_pos = {}}
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+ end)
+
+ it(':fclose command #9663', function()
+ local buf_a = meths.create_buf(false,false)
+ local buf_b = meths.create_buf(false,false)
+ local buf_c = meths.create_buf(false,false)
+ local buf_d = meths.create_buf(false,false)
+ local config_a = {relative='editor', width=11, height=11, row=5, col=5, border ='single', zindex=50}
+ local config_b = {relative='editor', width=8, height=8, row=7, col=7, border ='single', zindex=70}
+ local config_c = {relative='editor', width=4, height=4, row=9, col=9, border ='single',zindex=90}
+ local config_d = {relative='editor', width=2, height=2, row=10, col=10, border ='single',zindex=100}
+ meths.open_win(buf_a, false, config_a)
+ meths.open_win(buf_b, false, config_b)
+ meths.open_win(buf_c, false, config_c)
+ meths.open_win(buf_d, false, config_d)
+ local expected_pos = {
+ [4]={{id=1001}, 'NW', 1, 5, 5, true, 50},
+ [5]={{id=1002}, 'NW', 1, 7, 7, true, 70},
+ [6]={{id=1003}, 'NW', 1, 9, 9, true, 90},
+ [7]={{id=1004}, 'NW', 1, 10, 10, true, 100},
+ }
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:┌───────────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└───────────┘}|
+ ## grid 5
+ {5:┌────────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└────────┘}|
+ ## grid 6
+ {5:┌────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└────┘}|
+ ## grid 7
+ {5:┌──┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└──┘}|
+ ]], float_pos=expected_pos}
+ else
+ screen:expect([[
+ ^ {5:┌─┌─┌────┐─┐┐} |
+ {0:~ }{5:│}{1: }{5:│}{1: }{5:│}{1: }{5:│}{1: }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│┌──┐│}{2: }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~}{5:││}{1: }{5:││}{2: }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~}{5:││}{2:~ }{5:││}{2: }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~}{5:└└──┘┘}{2: }{5:││}{0: }|
+ |
+ ]])
+ end
+ -- close the window with the highest zindex value
+ command('fclose')
+ expected_pos[7] = nil
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+
+ ## grid 4
+ {5:┌───────────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└───────────┘}|
+ ## grid 5
+ {5:┌────────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└────────┘}|
+ ## grid 6
+ {5:┌────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└────┘}|
+ ]], float_pos=expected_pos}
+ else
+ screen:expect([[
+ ^ {5:┌─┌─┌────┐─┐┐} |
+ {0:~ }{5:│}{1: }{5:│}{1: }{5:│}{1: }{5:│}{1: }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~}{5:│}{2:~ }{5:│}{2: }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~}{5:└────┘}{2: }{5:││}{0: }|
+ |
+ ]])
+ end
+ -- with range
+ command('1fclose')
+ expected_pos[6] = nil
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+
+ ## grid 4
+ {5:┌───────────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└───────────┘}|
+ ## grid 5
+ {5:┌────────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└────────┘}|
+ ]], float_pos=expected_pos}
+ else
+ screen:expect([[
+ ^ {5:┌─┌────────┐┐} |
+ {0:~ }{5:│}{1: }{5:│}{1: }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }|
+ {0:~ }{5:│}{2:~}{5:│}{2:~ }{5:││}{0: }|
+ |
+ ]])
+ end
+ -- with bang
+ command('fclose!')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+
+ ]], float_pos={}}
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+ end)
end
describe('with ext_multigrid', function()