From 1c4b3d41b538078234282cfba74e5cf07c42c916 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 12 Mar 2023 10:40:27 +0800 Subject: fix(sleep): correct cursor placement (#22639) Just setcursor_mayforce(true) is enough as Nvim uses msg_grid. --- test/functional/ui/float_spec.lua | 274 +++++++++++++++++++++++++++++++++++++- 1 file changed, 273 insertions(+), 1 deletion(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 6759510ad1..6e67ec1f24 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -8909,7 +8909,6 @@ describe('float window', function() ]], win_viewport={ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; }} - else screen:expect{grid=[[ ^ | @@ -8952,6 +8951,279 @@ 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('iabcd') + 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}; + [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2}; + }} + else + screen:expect{grid=[[ + | + {0:~}{1:ab }{0: }| + {0:~}{1:cd }{0: }| + {0:~}{2:~ }{0: }| + {0:~ }| + {0:~ }| + :sleep 100^ | + ]]} + end + + feed('') + 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}; + [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2}; + }} + else + screen:expect{grid=[[ + | + {0:~}{1:ab }{0: }| + {0:~}{1:c^d }{0: }| + {0:~}{2:~ }{0: }| + {0:~ }| + {0:~ }| + :sleep 100 | + ]]} + end + feed('') + 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}; + [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2}; + }} + 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('') + 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}; + [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, linecount = 2}; + }} + 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('') + 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}; + [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 1, curcol = 1, linecount = 2}; + }} + 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('') + 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}; + [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 1, curcol = 1, linecount = 2}; + }} + 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('') + screen:expect_unchanged() + end) end describe('with ext_multigrid', function() -- cgit From 172227a44642b67ec8af5b438e5373a3daf61fdb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 12 Mar 2023 12:10:27 +0800 Subject: fix(screen): correctly draw background and eob with 'rightleft' (#22640) --- test/functional/ui/float_spec.lua | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 6e67ec1f24..4e691512c1 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -9224,6 +9224,55 @@ describe('float window', function() feed('') 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('iabcdef') + 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}; + [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 2}; + }} + 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) end describe('with ext_multigrid', function() -- cgit From fd2ece278b0941ec6673489e88868120e86b834a Mon Sep 17 00:00:00 2001 From: Matthias Deiml Date: Sun, 12 Mar 2023 23:58:46 +0100 Subject: feat(ui): add scroll_delta to win_viewport event #19270 scroll_delta contains how much the top line of a window moved since the last time win_viewport was emitted. It is expected to be used to implement smooth scrolling. For this purpose it only counts "virtual" or "displayed" so folds should count as one line. Because of this it adds extra information that cannot be computed from the topline parameter. Fixes #19227 --- test/functional/ui/float_spec.lua | 169 +++++++++++++++++++------------------- 1 file changed, 86 insertions(+), 83 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 4e691512c1..62e8221e87 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1433,8 +1433,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1476,8 +1476,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1519,8 +1519,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1562,8 +1562,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1606,8 +1606,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1647,8 +1647,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1688,8 +1688,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1731,8 +1731,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1781,8 +1781,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1868,8 +1868,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1911,8 +1911,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1954,8 +1954,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -1997,8 +1997,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 2, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2048,8 +2048,8 @@ describe('float window', function() ]], float_pos={ [4] = { { id = 1001 }, "NW", 1, 0, 0, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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=[[ @@ -2106,8 +2106,8 @@ describe('float window', function() ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 0, 5, true } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2165,8 +2165,8 @@ describe('float window', function() [5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 }, [6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 } }, win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, 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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -2618,7 +2618,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 +2627,7 @@ describe('float window', function() curline = 0, curcol = 3, linecount = 2, + sum_scroll_delta = 0, win = { id = 1001 } }, [5] = { @@ -2634,6 +2636,7 @@ describe('float window', function() curline = 0, curcol = 0, linecount = 1, + sum_scroll_delta = 0, win = { id = 1002 } } }} @@ -7149,8 +7152,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} meths.input_mouse('left', 'press', '', 5, 0, 0) @@ -7179,8 +7182,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} meths.input_mouse('left', 'drag', '', 5, 1, 2) @@ -7209,8 +7212,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -7279,8 +7282,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} meths.input_mouse('left', 'press', '', 5, 1, 1) @@ -7311,8 +7314,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} meths.input_mouse('left', 'drag', '', 5, 2, 3) @@ -7343,8 +7346,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -7413,8 +7416,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} meths.input_mouse('left', 'press', '', 5, 1, 0) @@ -7444,8 +7447,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} meths.input_mouse('left', 'drag', '', 5, 2, 2) @@ -7475,8 +7478,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -8228,8 +8231,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=[[ @@ -8285,10 +8288,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=[[ @@ -8333,8 +8336,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=[[ @@ -8390,10 +8393,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=[[ @@ -8453,10 +8456,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=[[ @@ -8502,8 +8505,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 +8552,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=[[ @@ -8604,8 +8607,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -8658,8 +8661,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -8701,7 +8704,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=[[ @@ -8756,8 +8759,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -8816,8 +8819,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -8865,8 +8868,8 @@ describe('float window', function() ]], float_pos={ [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -8907,7 +8910,7 @@ 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=[[ -- cgit From 5aec6114693dea442023857e071bf6f90c8c109a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 13 Mar 2023 08:14:02 +0800 Subject: test(float_spec): add missing sum_scroll_delta #22648 --- test/functional/ui/float_spec.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 62e8221e87..bae83537e5 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -8986,8 +8986,8 @@ describe('float window', function() ]], 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}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, 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 = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9028,8 +9028,8 @@ describe('float window', function() ]], 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}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, 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 = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9075,8 +9075,8 @@ describe('float window', function() ]], 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}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, 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 = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9119,8 +9119,8 @@ describe('float window', function() ]], 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}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 1, 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 = 3, curline = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9166,8 +9166,8 @@ describe('float window', function() ]], 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}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 1, curcol = 1, 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 = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9210,8 +9210,8 @@ describe('float window', function() ]], 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}; - [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 1, curcol = 1, 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 = 1, curcol = 1, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ @@ -9261,8 +9261,8 @@ describe('float window', function() ]], 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}; - [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, 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 = 3, curline = 1, curcol = 2, linecount = 2, sum_scroll_delta = 0}; }} else screen:expect{grid=[[ -- cgit From 0f1e2b6686694d878795fa090d4a08ba0f8acb4d Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 13 Mar 2023 20:38:21 +0100 Subject: fix(screen): redraw the ruler for a current floating window Semi-regression. The "ruler" behavior for a floating window was never really specified but in practice followed the users cursor movements in normal mode in a focused float, which seems like a reasonable behavior to now specify. --- test/functional/ui/float_spec.lua | 92 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index bae83537e5..5916c8e238 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -2184,6 +2184,98 @@ describe('float window', function() 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 5 + {1:^aaa aab }| + {1:abb acc }| + {2:~ }| + ]], float_pos={ + [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, 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 5 + {1:aaa ^aab }| + {1:abb acc }| + {2:~ }| + ]], float_pos={ + [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, 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('can have minimum size', function() insert("the background text") local buf = meths.create_buf(false, true) -- cgit From 3b28fb4cd9e1ef877968b4ffabf4d6b1cb17aa07 Mon Sep 17 00:00:00 2001 From: Patrick McFarland Date: Tue, 14 Mar 2023 13:21:53 -0400 Subject: fix(float): remove -1 in height clamp Problem: Clamp for height in floating windows enforced no more than editor height - 1, disallowing full editor height floating windows when using cmdheight=0 Solution: Clamp to full height, removing the -1. Tested to give the intended results with cmdheight=0, 1, or more than 1. This also inadvertently fixes a rendering error with cmdheight >1 where the bottom border would be overlapped by the cmdline. --- test/functional/ui/float_spec.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 5916c8e238..32f28dce26 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -2015,7 +2015,7 @@ describe('float window', function() 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,7 +2046,7 @@ 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, sum_scroll_delta = 0}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; @@ -2058,8 +2058,8 @@ describe('float window', function() {5:│}{2:~ }{5:│}| {5:│}{2:~ }{5:│}| {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| {5:└──────────────────────────────────────┘}| - | ]]} end end) @@ -3723,9 +3723,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 -- cgit From 34ac75b32927328a0c691c5bda987c0fdb5ce9eb Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 5 Apr 2023 17:19:53 +0100 Subject: refactor: rename local API alias from a to api Problem: Codebase inconsistently binds vim.api onto a or api. Solution: Use api everywhere. a as an identifier is too short to have at the module level. --- test/functional/ui/float_spec.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 32f28dce26..4612ffe56f 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -65,20 +65,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 CursorMoved * ++once '..winnr..'wincmd c') return buf, floatwin end crashes{'foo'} -- cgit From 0f42aa1f2a860ce6d72a825b397fe09c875613b5 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 6 Apr 2023 10:03:37 +0200 Subject: fix(highlight): use winhl=Foo:Bar even when Bar is empty fixes #22906 --- test/functional/ui/float_spec.lua | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 32f28dce26..890678e363 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -4935,6 +4935,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 5 + here | + float | + ]], float_pos={ + [5] = {{id = 1002}, "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}; + [5] = {win = {id = 1002}, 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 -- cgit From da979ae04b7a8c56586ed0233957600ad6af99f0 Mon Sep 17 00:00:00 2001 From: Munif Tanjim Date: Sun, 2 Apr 2023 23:01:10 +0600 Subject: fix(api): do not re-apply win_config.style when missing --- test/functional/ui/float_spec.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 32f28dce26..6d9197e1df 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -432,6 +432,25 @@ describe('float window', function() 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.win_set_option(float_win, 'number', true) + float_opts.row = 2 + meths.win_set_config(float_win, float_opts) + eq(false, meths.win_get_option(float_win, 'number')) + 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.win_set_option(float_win, 'number', true) + float_opts.row = 2 + float_opts.style = nil + meths.win_set_config(float_win, float_opts) + eq(true, meths.win_get_option(float_win, 'number')) + end) + it("'scroll' is computed correctly when opening float with splitkeep=screen #20684", function() meths.set_option('splitkeep', 'screen') local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10} -- cgit From 7095f8ff9d9ce3519abe34a3da4c8f4bdc3fc865 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 17 Apr 2023 17:32:32 +0100 Subject: vim-patch:9.0.1461: ruler not drawn correctly when using 'rulerformat' Problem: Ruler not drawn correctly when using 'rulerformat'. Solution: Adjust formatting depending on whether the ruler is drawn in the statusline or the command line. (Sean Dewar, closes vim/vim#12246) https://github.com/vim/vim/commit/fc8a601c3251c0388a88c1235b18c529385f7196 This issue was made apparent after neovim/neovim@0f1e2b6, as `showmode()` calls `win_redr_ruler()` with `curwin` now if it's floating, rather than the last window if there's no statusline (which usually already shares its right side with that of the editor). Co-authored-by: Sean Dewar --- test/functional/ui/float_spec.lua | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 3203b187cc..0e1842d087 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -2295,6 +2295,51 @@ describe('float window', function() 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('can have minimum size', function() insert("the background text") local buf = meths.create_buf(false, true) -- cgit From 65dd3c1180cef5ec15a46bd278ab3a0cb1c3460d Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 10 Apr 2023 21:40:35 +0100 Subject: fix(ruler): show ruler of curwin with no statusline in cmdline Problem: After neovim/neovim@846a056, only the ruler for current floating or last window without a statusline is drawn in the cmdline. This means that if the current window is not one of these, but has no statusline, its ruler will not be drawn anymore. Solution: Make `showmode()` draw the ruler of the current window or the last window in the cmdline if it has no statusline. This also maintains the previously restored floating window case (`float->w_status_height` should be 0). This behaviour should again match Vim, but without the overdraw it seems to do to achieve the same effect; it calls `showmode()` to draw the ruler for the last window without a statusline, then may draw over it in `showruler()` (which is now `show_cursor_info_later()` in Nvim) to show the ruler for the current window..? It's very confusing. Also update the logic in `win_redr_ruler()` to mirror the check done in `showmode()`, so that the ruler doesn't potentially draw over the long ins-completion mode message in some cases. --- test/functional/ui/float_spec.lua | 115 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 0e1842d087..e2fe0a2df5 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -2340,6 +2340,121 @@ describe('float window', function() 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 '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' + 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() insert("the background text") local buf = meths.create_buf(false, true) -- cgit From fbaa2787736173e417a93b958a9ca61e888e567d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 27 Apr 2023 23:40:39 +0800 Subject: fix(pum): make :popup position correctly with float border --- test/functional/ui/float_spec.lua | 123 +++++++++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 3 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index e2fe0a2df5..28c16642f1 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 @@ -2123,7 +2124,7 @@ describe('float window', function() {5:║}{1:^ }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [5] = { { id = 1002 }, "NW", 1, 0, 5, true } + [5] = { { id = 1002 }, "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}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3, sum_scroll_delta = 0}; @@ -2181,8 +2182,8 @@ describe('float window', function() {1: abb }| {13: acc }| ]], float_pos={ - [5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 }, - [6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 } + [5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 }; + [6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 }; }, win_viewport={ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3, sum_scroll_delta = 0}; @@ -2201,6 +2202,122 @@ describe('float window', function() {3:-- }{8:match 1 of 4} | ]]} end + + feed '' + 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 5 + {5:╔═════════╗}| + {5:║}{1:aaa aab }{5:║}| + {5:║}{1:abb acc }{5:║}| + {5:║}{1:ac^c }{5:║}| + {5:╚═════════╝}| + ]], float_pos={ + [5] = { { id = 1002 }, "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}; + [5] = {win = {id = 1002}, 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' + 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 5 + {5:╔═════════╗}| + {5:║}{1:aaa aab }{5:║}| + {5:║}{1:abb acc }{5:║}| + {5:║}{1:ac^c }{5:║}| + {5:╚═════════╝}| + ## grid 6 + {1: foo }| + {1: bar }| + {1: baz }| + ]], float_pos={ + [5] = { { id = 1002 }, "NW", 1, 0, 5, true }; + [6] = { { id = -1 }, "NW", 5, 4, 2, false, 250 }; + }, win_viewport={ + [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = {id = 1002}, 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() -- cgit From 03ca36d1f8d027c95edd46f3127284e9a3577990 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 10 May 2023 23:46:50 +0800 Subject: fix(highlight): apply 'winblend' to NormalNC (#23555) --- test/functional/ui/float_spec.lua | 63 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 28c16642f1..46a079d9ff 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -8079,10 +8079,13 @@ 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}, }) insert([[ Lorem ipsum dolor sit amet, consectetur @@ -8184,6 +8187,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 5 + {13:test }| + {13: }| + {13:popup text }| + ]], float_pos={ + [5] = {{id = 1002}, "NW", 1, 2, 5, true, 50}; + }} + 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 + meths.set_option_value('winhighlight', '', {win = win}) + command('hi link NormalNC Visual') + screen:expect_unchanged(true) + command('hi clear NormalNC') + command('hi SpecialRegion guifg=Red blend=0') meths.buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1) if multigrid then -- cgit From 1fe1bb084d0099fc4f9bfdc11189485d0f74b75a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 19 Dec 2022 16:37:45 +0000 Subject: refactor(options): deprecate nvim[_buf|_win]_[gs]et_option Co-authored-by: zeertzjq Co-authored-by: famiu --- test/functional/ui/float_spec.lua | 52 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 46a079d9ff..19ad340dd5 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -105,7 +105,7 @@ describe('float window', function() 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 = { @@ -127,7 +127,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 = { @@ -427,36 +427,36 @@ 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) + end) - it("should re-apply 'style' when present", function() + 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.win_set_option(float_win, 'number', true) + meths.set_option_value('number', true, { win = float_win }) float_opts.row = 2 meths.win_set_config(float_win, float_opts) - eq(false, meths.win_get_option(float_win, 'number')) + 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.win_set_option(float_win, 'number', true) + 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.win_get_option(float_win, 'number')) + 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) describe('with only one tabpage,', function() @@ -4553,8 +4553,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 @@ -7823,7 +7823,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 @@ -8144,7 +8144,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 @@ -8452,7 +8452,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')}, @@ -8694,7 +8694,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=[[ @@ -8739,10 +8739,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 @@ -8799,7 +8799,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=[[ @@ -8844,10 +8844,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 @@ -8904,11 +8904,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=[[ @@ -8967,7 +8967,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=[[ -- cgit From 700cab00680fa25e0dbdf6f91f638f4da5a09909 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 4 Jun 2023 09:09:22 +0800 Subject: fix(events)!: trigger CursorMoved later on switching window (#23711) --- test/functional/ui/float_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 19ad340dd5..46c2127c30 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -79,7 +79,7 @@ describe('float window', function() api.nvim_buf_set_lines(buf, 0, -1, true, contents) local winnr = vim.fn.win_id2win(floatwin) api.nvim_command('wincmd p') - api.nvim_command('autocmd CursorMoved * ++once '..winnr..'wincmd c') + api.nvim_command('autocmd BufEnter * ++once '..winnr..'wincmd c') return buf, floatwin end crashes{'foo'} -- cgit From 71ad771ea4b77119abcff706b9666fa534963819 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 18 Aug 2023 12:08:18 +0800 Subject: fix(ui_compositor): only reset skipstart at first column (#24776) Problem: A double-width char in a floating window causes an extra space to be drawn to the left of its boundary. Solution: Only reset skipstart at the first column. Fix #24775 --- test/functional/ui/float_spec.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 46c2127c30..c2bcac2449 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -8377,6 +8377,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=[[ @@ -8397,15 +8398,15 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 4 - {1: }| - {1: }| + ## grid 5 + {1:口 }| + {1:口 }| {1: }| - ]], float_pos={ [4] = { { id = 1001 }, "NW", 1, 0, 11, true } }} + ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 0, 11, true } }} else screen:expect([[ - # TODO: 测 {1: }信息的准确性 | - # FIXME: 测{1: } 信息的准确^性 | + # TODO: 测 {1:口 }信息的准确性 | + # FIXME: 测{1:口 } 信息的准确^性 | {0:~ }{1: }{0: }| {0:~ }| {0:~ }| -- cgit From 008154954791001efcc46c28146e21403f3a698b Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 21 Aug 2023 14:52:17 +0200 Subject: refactor(change): do API changes to buffer without curbuf switch Most of the messy things when changing a non-current buffer is not about the buffer, it is about windows. In particular, it is about `curwin`. When editing a non-current buffer which is displayed in some other window in the current tabpage, one such window will be "borrowed" as the curwin. But this means if two or more non-current windows displayed the buffers, one of them will be treated differenty. this is not desirable. In particular, with nvim_buf_set_text, cursor _column_ position was only corrected for one single window. Two new tests are added: the test with just one non-current window passes, but the one with two didn't. Two corresponding such tests were also added for nvim_buf_set_lines. This already worked correctly on master, but make sure this is well-tested for future refactors. Also, nvim_create_buf no longer invokes autocmds just because you happened to use `scratch=true`. No option value was changed, therefore OptionSet must not be fired. --- test/functional/ui/float_spec.lua | 472 ++++++++++++++++++-------------------- 1 file changed, 223 insertions(+), 249 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index c2bcac2449..85795e7e17 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1445,16 +1445,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1488,16 +1488,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1531,16 +1531,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1574,16 +1574,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1618,16 +1618,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1661,14 +1661,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1702,14 +1702,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1743,16 +1743,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1794,15 +1794,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1880,16 +1880,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1923,16 +1923,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -1966,16 +1966,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -2009,16 +2009,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -2117,17 +2117,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3, 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=[[ @@ -2170,23 +2170,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3, 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=[[ @@ -2229,17 +2229,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:ac^c }{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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, 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=[[ @@ -2287,22 +2287,22 @@ describe('float window', function() {0:~ }| ## grid 3 :popup Test | - ## grid 5 + ## grid 4 {5:╔═════════╗}| {5:║}{1:aaa aab }{5:║}| {5:║}{1:abb acc }{5:║}| {5:║}{1:ac^c }{5:║}| {5:╚═════════╝}| - ## grid 6 + ## grid 5 {1: foo }| {1: bar }| {1: baz }| ]], float_pos={ - [5] = { { id = 1002 }, "NW", 1, 0, 5, true }; - [6] = { { id = -1 }, "NW", 5, 4, 2, false, 250 }; + [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}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, 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=[[ @@ -2347,15 +2347,15 @@ describe('float window', function() {0:~ }| ## grid 3 1,1 All | - ## grid 5 + ## grid 4 {1:^aaa aab }| {1:abb acc }| {2:~ }| ]], 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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -2389,15 +2389,15 @@ describe('float window', function() {0:~ }| ## grid 3 1,5 All | - ## grid 5 + ## grid 4 {1:aaa ^aab }| {1:abb acc }| {2:~ }| ]], 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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 4, linecount = 2, 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=[[ @@ -2596,10 +2596,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([[ @@ -2633,10 +2633,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([[ @@ -3132,13 +3132,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([[ @@ -3189,13 +3189,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([[ @@ -3246,13 +3246,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([[ @@ -3303,13 +3303,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([[ @@ -3379,12 +3379,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=[[ @@ -3414,12 +3412,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=[[ @@ -3448,12 +3444,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 @@ -3492,12 +3486,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=[[ @@ -3540,12 +3532,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=[[ @@ -3567,15 +3557,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| @@ -3589,9 +3579,9 @@ describe('float window', function() the | ## grid 3 | - ## grid 5 + ## grid 4 {1:some info! }| - ## grid 6 + ## grid 5 ^ | {0:~ }| {0:~ }| @@ -3602,9 +3592,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=[[ @@ -3648,12 +3636,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=[[ @@ -3696,12 +3682,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=[[ @@ -3744,12 +3728,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=[[ @@ -3815,10 +3797,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([[ @@ -3874,7 +3856,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=[[ @@ -3895,7 +3877,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:such }| {1:very }| {1:float }| @@ -3929,7 +3911,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:such }| {1:very }| {1:float }| @@ -3959,7 +3941,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:such }| {1:very }| {1:float }| @@ -3986,7 +3968,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:such }| {1:very }| {1:float }| @@ -4011,7 +3993,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:such }| {1:very }| {1:^float }| @@ -4045,7 +4027,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:such }| {1:very }| {1:^float }| @@ -4084,7 +4066,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -4121,7 +4103,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -4158,7 +4140,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -4195,7 +4177,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -4232,7 +4214,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -4269,7 +4251,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -4306,7 +4288,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -4343,7 +4325,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -4371,7 +4353,7 @@ describe('float window', function() | ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -4403,7 +4385,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:^such }| {1:very }| {1:float }| @@ -5063,12 +5045,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([[ @@ -5104,11 +5086,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([[ @@ -5256,14 +5238,14 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 here | float | ]], 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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, 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=[[ @@ -7580,18 +7562,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, 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:----------------------------------------]| @@ -7610,18 +7592,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, 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:----------------------------------------]| @@ -7640,15 +7622,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, 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=[[ @@ -7708,20 +7690,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, 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:----------------------------------------]| @@ -7740,20 +7722,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, 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:----------------------------------------]| @@ -7772,17 +7754,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, 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=[[ @@ -7843,19 +7825,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, 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:----------------------------------------]| @@ -7874,19 +7856,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, 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:----------------------------------------]| @@ -7905,16 +7887,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, 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=[[ @@ -7959,11 +7941,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 @@ -7974,7 +7956,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 ^foo | bar | baz | @@ -7982,14 +7964,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 @@ -8000,7 +7982,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 foo | bar | ba^z | @@ -8008,14 +7990,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 @@ -8026,7 +8008,7 @@ describe('float window', function() {0:~ }| ## grid 3 {3:-- VISUAL --} | - ## grid 5 + ## grid 4 foo | b^a{27:r} | {27:baz} | @@ -8125,11 +8107,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 | @@ -8168,11 +8150,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 | @@ -8212,12 +8194,12 @@ describe('float window', function() laborum^. | ## grid 3 | - ## grid 5 + ## grid 4 {13:test }| {13: }| {13:popup text }| ]], float_pos={ - [5] = {{id = 1002}, "NW", 1, 2, 5, true, 50}; + [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50}; }} else screen:expect([[ @@ -8264,11 +8246,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 | @@ -8307,11 +8289,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 | @@ -8328,7 +8310,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:--------------------------------------------------]| @@ -8351,11 +8333,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([[ @@ -8398,11 +8380,11 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {1:口 }| {1:口 }| {1: }| - ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 0, 11, true } }} + ]], float_pos={ [4] = { { id = 1001 }, "NW", 1, 0, 11, true } }} else screen:expect([[ # TODO: 测 {1:口 }信息的准确性 | @@ -8480,14 +8462,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([[ @@ -8521,14 +8501,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([[ @@ -8590,11 +8568,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:- -}| @@ -8604,11 +8582,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 @@ -8658,11 +8636,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:- -}| @@ -8672,12 +8650,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([[ @@ -9088,7 +9062,7 @@ describe('float window', function() {0:~ }| {0:~ }| ## grid 3 - ## grid 5 + ## grid 4 {5:┌────────────────────────────────────────┐}| {5:│}{1: }{5:│}| {5:│}{1: }{5:│}| @@ -9096,10 +9070,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, 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=[[ @@ -9144,16 +9118,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, 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=[[ @@ -9240,7 +9214,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 5 + ## grid 4 {5:┌────────────────────────────────────────┐}| {5:│}{1: }{5:│}| {5:│}{1: }{5:│}| @@ -9248,10 +9222,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, 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=[[ @@ -9300,7 +9274,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:│}| @@ -9308,10 +9282,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, 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=[[ @@ -9351,16 +9325,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, sum_scroll_delta = 0}; - [5] = {win = {id = 1002}, 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=[[ -- cgit From 35570e4a11bef061777d741929f74fa66ba3f45a Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Fri, 25 Aug 2023 10:53:35 +0300 Subject: feat(float): implement footer Problem: Now way to show text at the bottom part of floating window border (a.k.a. "footer"). Solution: Allows `footer` and `footer_pos` config fields similar to `title` and `title_pos`. --- test/functional/ui/float_spec.lua | 395 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 395 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 85795e7e17..6cdd6e51fa 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1851,6 +1851,39 @@ 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('border with title', function() local buf = meths.create_buf(false, false) @@ -2033,6 +2066,368 @@ 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 + + meths.win_set_config(win, {title= { {"🦄"},{"BB"}},title_pos="right",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:╔═════}🦄BB{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:╔═════}🦄BB{5:╗}{0: }| + {0:~ }{5:║}{1: halloj! }{5:║}{0: }| + {0:~ }{5:║}{1: BORDAA }{5:║}{0: }| + {0:~ }{5:╚═════}🦄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", zindex=201}) -- cgit From f5953edbac14febce9d4f8a3c35bdec1eae26fbe Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 14 Sep 2023 07:42:22 +0800 Subject: fix(float): update position of anchored windows first (#25133) --- test/functional/ui/float_spec.lua | 193 +++++++++++++++++++++++++++++++++++++- 1 file changed, 192 insertions(+), 1 deletion(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 6cdd6e51fa..4e2cee391a 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -3279,7 +3279,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=[[ @@ -3725,6 +3724,198 @@ describe('float window', function() end end) + it('anchored to another floating window updated in the same call #14735', function() + feed('i') + + 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 -- cgit From a916523574135549865d698732a6c9eaae7c7811 Mon Sep 17 00:00:00 2001 From: glepnir Date: Sun, 10 Sep 2023 15:09:20 +0800 Subject: fix(ui): doesn't trigger au event when enter is false --- test/functional/ui/float_spec.lua | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 6cdd6e51fa..0cf8a124ff 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -415,6 +415,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 -- cgit From fd08fd3de3020647c8ae73f1c7d2cf9a4926c828 Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 14 Sep 2023 13:30:51 +0800 Subject: fix(float): add fixd option --- test/functional/ui/float_spec.lua | 83 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 4e2cee391a..4ede03f242 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -899,6 +899,89 @@ describe('float window', function() end end) + it('window position fixed', function() + local buf = meths.create_buf(false,false) + command("set nowrap") + local win = meths.open_win(buf, false, { + relative='editor', width=20, height=2, row=2, col=30, anchor = 'NW', fixed = true}) + local expected_pos = { + [4]={{id=1001}, 'NW', 1, 2, 30, 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 + {1: }| + {2:~ }| + ]], float_pos=expected_pos} + else + screen:expect([[ + ^ | + {0:~ }| + {0:~ }{1: }| + {0:~ }{2:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end + + meths.win_set_config(win, { + relative='editor', width=20, height=2, row=2, col=30, anchor = 'NW', fixed = 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:~ }{2:~ }| + {0:~ }| + {0:~ }| + | + ]]) + 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 -- cgit From 437ed3cee2d29a24d555a873d024cd851b953153 Mon Sep 17 00:00:00 2001 From: glepnir Date: Mon, 11 Sep 2023 19:46:15 +0800 Subject: fix(float): trigger winnew event when float window create --- test/functional/ui/float_spec.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index e37b3ccb5f..556859478e 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -103,6 +103,29 @@ 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.go.winheight = 20 -- cgit From c5abf487f19e45fe96a001b28b9e7981f43eed7d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 19 Sep 2023 18:45:11 +0800 Subject: fix(float): make "fixed" work with relative=win (#25243) --- test/functional/ui/float_spec.lua | 98 ++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 58 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index fcda0dad74..e1d5f6b965 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -940,85 +940,67 @@ describe('float window', function() end) it('window position fixed', function() + command('rightbelow 20vsplit') local buf = meths.create_buf(false,false) - command("set nowrap") local win = meths.open_win(buf, false, { - relative='editor', width=20, height=2, row=2, col=30, anchor = 'NW', fixed = true}) - local expected_pos = { - [4]={{id=1001}, 'NW', 1, 2, 30, true}, - } + relative='win', width=15, height=2, row=2, col=10, anchor='NW', fixed=true}) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| + [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:~ }| - {0:~ }| + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| ## grid 3 | ## grid 4 - {1: }| - {2:~ }| - ]], float_pos=expected_pos} + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 5 + {1: }| + {2:~ }| + ]], float_pos={ + [5] = {{id = 1002}, "NW", 4, 2, 10, true, 50}; + }} else screen:expect([[ - ^ | - {0:~ }| - {0:~ }{1: }| - {0:~ }{2:~ }| - {0:~ }| - {0:~ }| + {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, { - relative='editor', width=20, height=2, row=2, col=30, anchor = 'NW', fixed = false}) + meths.win_set_config(win, {fixed=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} + screen:expect_unchanged() else screen:expect([[ - ^ | - {0:~ }| - {0:~ }{1: }| - {0:~ }{2:~ }| - {0:~ }| - {0:~ }| + {5:│}^ | + {0:~ }{5:│}{0:~ }| + {0:~ }{5:│}{0:~ }{1: }| + {0:~ }{5:│}{0:~ }{2:~ }| + {0:~ }{5:│}{0:~ }| + {5:[No Name] }{4:[No Name] }| | - ]]) + ]]) end end) -- cgit From adb73772d9197a7fa6e9ee7a2e8874118e60844d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 21 Sep 2023 08:00:03 +0800 Subject: vim-patch:9.0.1919: Wrong curswant when clicking on empty line or with vsplits Problem: Wrong curswant when clicking on empty line or with vsplits. Solution: Don't check for ScreenCols[] before the start of the window and handle empty line properly. closes: vim/vim#13132 https://github.com/vim/vim/commit/03cd697d635f1b0e7ffe21cf8244a8fb755f2ddb --- test/functional/ui/float_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index f75fb52108..e077e21216 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -6287,7 +6287,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:----------------------------------------]| @@ -6366,7 +6366,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:----------------------------------------]| -- cgit From acc32f20bedd611a582aedf08d64ad66d2a19d3b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 21 Sep 2023 09:55:47 +0800 Subject: test(ui/float_spec): click in bordered float sets correct curswant --- test/functional/ui/float_spec.lua | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index e077e21216..8c9b30d510 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -8764,6 +8764,75 @@ 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()) + end) + it("'winblend' option", function() screen:try_resize(50,9) screen:set_default_attr_ids({ -- cgit From e25cf47ad3e10e0e1ae2b2376d898382af5b1e26 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 21 Sep 2023 10:20:30 +0800 Subject: fix(mouse): click on empty line with 'foldcolumn' --- test/functional/ui/float_spec.lua | 111 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 8c9b30d510..4fea513249 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -8831,6 +8831,117 @@ describe('float window', function() 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() -- cgit From 64e8a3c4d19eab40888fbac36b96e97bd9d68c42 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 22 Sep 2023 15:36:24 +0800 Subject: fix(ui): handle virtual text with multiple hl in more cases (#25304) --- test/functional/ui/float_spec.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 4fea513249..93ca1aef3f 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -821,7 +821,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}, @@ -2512,7 +2512,12 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {title= { {"🦄"},{"BB"}},title_pos="right",footer= { {"🦄"},{"BB"}},footer_pos="right"}) + 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 @@ -2533,10 +2538,10 @@ describe('float window', function() ## grid 3 | ## grid 4 - {5:╔═════}🦄BB{5:╗}| + {5:╔═════}🦄{7:BB}{5:╗}| {5:║}{1: halloj! }{5:║}| {5:║}{1: BORDAA }{5:║}| - {5:╚═════}🦄BB{5:╝}| + {5:╚═════}🦄{7:BB}{5:╝}| ]], float_pos={ [4] = { { id = 1001 }, "NW", 1, 2, 5, true } }, win_viewport={ @@ -2547,10 +2552,10 @@ describe('float window', function() screen:expect{grid=[[ ^ | {0:~ }| - {0:~ }{5:╔═════}🦄BB{5:╗}{0: }| + {0:~ }{5:╔═════}🦄{7:BB}{5:╗}{0: }| {0:~ }{5:║}{1: halloj! }{5:║}{0: }| {0:~ }{5:║}{1: BORDAA }{5:║}{0: }| - {0:~ }{5:╚═════}🦄BB{5:╝}{0: }| + {0:~ }{5:╚═════}🦄{7:BB}{5:╝}{0: }| | ]]} end -- cgit From c0a29931e29bbb40650df01918826cdb64e8fc32 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 23 Sep 2023 14:42:59 +0800 Subject: fix(unhide): close floating windows first (#25318) --- test/functional/ui/float_spec.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 93ca1aef3f..e21e4e4aad 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -522,6 +522,16 @@ describe('float window', function() eq(5, meths.get_option_value('scroll', {win=float_win.id})) end) + it(':unhide works when there are floating windows #17797', function() + local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10} + 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) + describe('with only one tabpage,', function() local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1} local old_buf, old_win -- cgit From fcdfbb430377a82921cf1a72df97bce7952733e8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 23 Sep 2023 22:33:44 +0800 Subject: fix(float): fix some other crashes with :unhide or :all (#25328) --- test/functional/ui/float_spec.lua | 163 +++++++++++++++++++++++++++++++++++++- 1 file changed, 161 insertions(+), 2 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index e21e4e4aad..6db9e7af3e 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -522,8 +522,8 @@ describe('float window', function() eq(5, meths.get_option_value('scroll', {win=float_win.id})) end) - it(':unhide works when there are floating windows #17797', function() - local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10} + 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) @@ -532,6 +532,17 @@ describe('float window', function() 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() local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1} local old_buf, old_win @@ -3222,6 +3233,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'", -- cgit From 4200a0f1678c06c6da4e4cfb0184c29c1174ed21 Mon Sep 17 00:00:00 2001 From: glepnir Date: Wed, 27 Sep 2023 17:23:42 +0800 Subject: feat(float): support toggle show float window --- test/functional/ui/float_spec.lua | 126 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 4 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 6db9e7af3e..18c8a7370f 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1172,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) @@ -4281,7 +4281,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('') @@ -10809,6 +10809,124 @@ describe('float window', function() ]]} 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) end describe('with ext_multigrid', function() -- cgit From 372aa2eb3db375385cf19dc0a6571f790b858241 Mon Sep 17 00:00:00 2001 From: glepnir Date: Mon, 9 Oct 2023 18:47:10 +0800 Subject: feat(float): add fclose command --- test/functional/ui/float_spec.lua | 180 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 18c8a7370f..ab02094beb 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -10927,6 +10927,186 @@ describe('float window', function() ]]) end end) + + it('fclose command #9663', function() + local bufA = meths.create_buf(false,false) + local bufB = meths.create_buf(false,false) + local bufC = meths.create_buf(false,false) + local bufD = 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(bufA, false, config_A) + meths.open_win(bufB, false, config_B) + meths.open_win(bufC, false, config_C) + meths.open_win(bufD, false, config_D) + --close window which have higher zindex value + command('fclose') + 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}, + } + 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() -- cgit From f79052faef874b19ebbed007c30eb3f2c994a8b2 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 11 Oct 2023 15:03:59 +0800 Subject: refactor(float): rename ex_floatclose to ex_fclose (#25596) --- test/functional/ui/float_spec.lua | 152 ++++++++++++++++++++++++++++---------- 1 file changed, 111 insertions(+), 41 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index ab02094beb..400b2bbae7 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -10928,26 +10928,96 @@ describe('float window', function() end end) - it('fclose command #9663', function() - local bufA = meths.create_buf(false,false) - local bufB = meths.create_buf(false,false) - local bufC = meths.create_buf(false,false) - local bufD = 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(bufA, false, config_A) - meths.open_win(bufB, false, config_B) - meths.open_win(bufC, false, config_C) - meths.open_win(bufD, false, config_D) - --close window which have higher zindex value - command('fclose') + 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 @@ -11000,21 +11070,21 @@ describe('float window', function() {5:│}{2:~ }{5:│}| {5:│}{2:~ }{5:│}| {5:└────┘}| - ]],float_pos= expected_pos} + ]], 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: }| - | + ^ {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 + expected_pos[6] = nil if multigrid then screen:expect{grid=[[ ## grid 1 @@ -11060,19 +11130,19 @@ describe('float window', function() {5:│}{2:~ }{5:│}| {5:│}{2:~ }{5:│}| {5:└────────┘}| - ]],float_pos= expected_pos} + ]], 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: }| - | + ^ {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 + -- with bang command('fclose!') if multigrid then screen:expect{grid=[[ @@ -11094,16 +11164,16 @@ describe('float window', function() ## grid 3 | - ]],float_pos= {}} + ]], float_pos={}} else screen:expect([[ - ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - | + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | ]]) end end) -- cgit From bf70a33f5e7de0218704126c149db24542e39766 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 Oct 2023 09:58:30 +0800 Subject: vim-patch:8.1.0822: peeking and flushing output slows down execution (#25629) Problem: Peeking and flushing output slows down execution. Solution: Do not update the mode message when global_busy is set. Do not flush when only peeking for a character. (Ken Takata) https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c --- test/functional/ui/float_spec.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 400b2bbae7..9f6b3ca296 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -9284,9 +9284,11 @@ describe('float window', function() end -- Also test with global NormalNC highlight - meths.set_option_value('winhighlight', '', {win = win}) - command('hi link NormalNC Visual') - screen:expect_unchanged(true) + 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') -- cgit From 9de157bce4b6eb055a0d7a39d1ed6b7a6e6c6545 Mon Sep 17 00:00:00 2001 From: nwounkn Date: Thu, 26 Oct 2023 08:44:28 +0500 Subject: fix(float): win_get_bordertext_col returning negative column number (#25752) Problem: `win_get_bordertext_col` returns column < 1 for right or center aligned text, if its length is more than window width. Solution: Return max(resulting_column, 1) --- test/functional/ui/float_spec.lua | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 9f6b3ca296..f9849ea7fa 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -2034,6 +2034,61 @@ describe('float window', function() 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) meths.buf_set_lines(buf, 0, -1, true, {' halloj! ', -- cgit From 6c3e170e5668e72b2b144a86b4e8278bc70daa48 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 11 Nov 2023 15:12:58 +0800 Subject: fix(highlight): apply 'winblend' to float border (#25981) --- test/functional/ui/float_spec.lua | 63 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index f9849ea7fa..c9f28f430a 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1017,7 +1017,7 @@ describe('float window', function() {1: }| {2:~ }| ]], float_pos={ - [5] = {{id = 1002}, "NW", 4, 2, 10, true, 50}; + [5] = {{id = 1002}, "NW", 4, 2, 10, true}; }} else screen:expect([[ @@ -9191,6 +9191,13 @@ describe('float window', function() [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}; }) insert([[ Lorem ipsum dolor sit amet, consectetur @@ -9321,9 +9328,7 @@ describe('float window', function() {13:test }| {13: }| {13:popup text }| - ]], float_pos={ - [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50}; - }} + ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}} else screen:expect([[ Ut enim ad minim veniam, quis nostrud | @@ -9477,6 +9482,56 @@ describe('float window', function() | ]]) end + + -- Check that 'winblend' applies to border + meths.win_set_config(win, {border='single'}) + 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:┌───────────────┐}| + {17:│}{11:popup text}{18: }{17:│}| + {17:│}{19:~ }{17:│}| + {17:│}{19:~ }{17:│}| + {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:┌───────────────┐}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:└───────────────┘}{16:ollit anim id est }| + laborum. | + | + ]]) + end end) it('can overlap doublewidth chars', function() -- cgit From 9ecb43b6372feb49d6d497c41aa75d2cce1a1446 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 12 Nov 2023 09:23:34 +0800 Subject: fix(float): apply 'winblend' to title/footer highlight (#25999) --- test/functional/ui/float_spec.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index c9f28f430a..2902b4a4a5 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -9198,6 +9198,9 @@ describe('float window', function() [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 @@ -9483,8 +9486,8 @@ describe('float window', function() ]]) end - -- Check that 'winblend' applies to border - meths.win_set_config(win, {border='single'}) + -- 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') @@ -9513,21 +9516,21 @@ describe('float window', function() ## grid 3 | ## grid 4 - {17:┌───────────────┐}| + {17:┌}{23:Title}{17:──────────┐}| {17:│}{11:popup text}{18: }{17:│}| {17:│}{19:~ }{17:│}| {17:│}{19:~ }{17:│}| - {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:┌───────────────┐}Duis aute irure dolor in | + 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:└───────────────┘}{16:ollit anim id est }| + {16:^qui o}{22:└}{25:Footer}{22:─────────┘}{16:ollit anim id est }| laborum. | | ]]) -- cgit