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/api/window_spec.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index ecab6a4713..660fa4731e 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -363,22 +363,22 @@ describe('API/win', function() end) end) - describe('nvim_win_get_option, nvim_win_set_option', function() + describe('nvim_get_option_value, nvim_set_option_value', function() it('works', function() - curwin('set_option', 'colorcolumn', '4,3') - eq('4,3', curwin('get_option', 'colorcolumn')) + nvim('set_option_value', 'colorcolumn', '4,3', {win=0}) + eq('4,3', nvim('get_option_value', 'colorcolumn', {win = 0})) command("set modified hidden") command("enew") -- edit new buffer, window option is preserved - eq('4,3', curwin('get_option', 'colorcolumn')) + eq('4,3', nvim('get_option_value', 'colorcolumn', {win = 0})) -- global-local option - curwin('set_option', 'statusline', 'window-status') - eq('window-status', curwin('get_option', 'statusline')) - eq('', nvim('get_option', 'statusline')) + nvim('set_option_value', 'statusline', 'window-status', {win=0}) + eq('window-status', nvim('get_option_value', 'statusline', {win=0})) + eq('', nvim('get_option_value', 'statusline', {scope='global'})) command("set modified") command("enew") -- global-local: not preserved in new buffer -- confirm local value was not copied - eq('', curwin('get_option', 'statusline')) + eq('', nvim('get_option_value', 'statusline', {win = 0})) eq('', eval('&l:statusline')) end) @@ -386,16 +386,16 @@ describe('API/win', function() nvim('command', 'tabnew') local tab1 = unpack(nvim('list_tabpages')) local win1 = unpack(tabpage('list_wins', tab1)) - window('set_option', win1, 'statusline', 'window-status') + nvim('set_option_value', 'statusline', 'window-status', {win=win1.id}) nvim('command', 'split') nvim('command', 'wincmd J') nvim('command', 'wincmd j') - eq('window-status', window('get_option', win1, 'statusline')) + eq('window-status', nvim('get_option_value', 'statusline', {win = win1.id})) assert_alive() end) it('returns values for unset local options', function() - eq(-1, curwin('get_option', 'scrolloff')) + eq(-1, nvim('get_option_value', 'scrolloff', {win=0, scope='local'})) end) end) @@ -568,11 +568,11 @@ describe('API/win', function() it('deletes the buffer when bufhidden=wipe', function() local oldwin = meths.get_current_win() local oldbuf = meths.get_current_buf() - local buf = meths.create_buf(true, false) + local buf = meths.create_buf(true, false).id local newwin = meths.open_win(buf, true, { relative='win', row=3, col=3, width=12, height=3 }) - meths.buf_set_option(buf, 'bufhidden', 'wipe') + meths.set_option_value('bufhidden', 'wipe', {buf=buf}) meths.win_hide(newwin) eq({oldwin}, meths.list_wins()) eq({oldbuf}, meths.list_bufs()) -- cgit From 576dddb46168e81aa0f78c28816082c662dedea1 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Mon, 22 May 2023 12:47:10 +0600 Subject: test: don't unnecessarily specify win/buf for `nvim_(get|set)_option_value` `nvim_(get|set)_option_value` pick the current buffer / window by default for buffer-local/window-local (but not global-local) options. So specifying `buf = 0` or `win = 0` in opts is unnecessary for those options. This PR removes those to reduce code clutter. --- test/functional/api/window_spec.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 660fa4731e..a6d1807961 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -365,11 +365,11 @@ describe('API/win', function() describe('nvim_get_option_value, nvim_set_option_value', function() it('works', function() - nvim('set_option_value', 'colorcolumn', '4,3', {win=0}) - eq('4,3', nvim('get_option_value', 'colorcolumn', {win = 0})) + nvim('set_option_value', 'colorcolumn', '4,3', {}) + eq('4,3', nvim('get_option_value', 'colorcolumn', {})) command("set modified hidden") command("enew") -- edit new buffer, window option is preserved - eq('4,3', nvim('get_option_value', 'colorcolumn', {win = 0})) + eq('4,3', nvim('get_option_value', 'colorcolumn', {})) -- global-local option nvim('set_option_value', 'statusline', 'window-status', {win=0}) -- cgit From 68e7a6a6dccff344f880e85e4e9f87104904c8a8 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 1 Jun 2023 12:23:42 +0200 Subject: test: added tests for set_height with winminheight=0 and a winbar --- test/functional/api/window_spec.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index a6d1807961..55d4ff6b2e 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -285,6 +285,22 @@ describe('API/win', function() eq(2, window('get_height', nvim('list_wins')[2])) end) + it('correctly handles height=1', function() + nvim('command', 'split') + nvim('set_current_win', nvim('list_wins')[1]) + window('set_height', nvim('list_wins')[2], 1) + eq(1, window('get_height', nvim('list_wins')[2])) + end) + + it('correctly handles height=1 with a winbar', function() + nvim('command', 'set winbar=foobar') + nvim('command', 'set winminheight=0') + nvim('command', 'split') + nvim('set_current_win', nvim('list_wins')[1]) + window('set_height', nvim('list_wins')[2], 1) + eq(1, window('get_height', nvim('list_wins')[2])) + end) + it('do not cause ml_get errors with foldmethod=expr #19989', function() insert([[ aaaaa -- cgit From db8fe63a9398efd57c3ff28aa3d93e45fb70ee1a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 11 Jul 2023 07:15:46 +0800 Subject: feat(api): add nvim_win_text_height (#24236) It uses the same code as "scroll_delta" of "win_viewport" UI event to calculate text height, but is more flexible. --- test/functional/api/window_spec.lua | 211 ++++++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 55d4ff6b2e..8038a84139 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -595,6 +595,217 @@ describe('API/win', function() end) end) + describe('text_height', function() + it('validation', function() + local X = meths.get_vvar('maxcol') + insert([[ + aaa + bbb + ccc + ddd + eee]]) + eq("Invalid window id: 23", + pcall_err(meths.win_text_height, 23, {})) + eq("Line index out of bounds", + pcall_err(curwinmeths.text_height, { start_row = 5 })) + eq("Line index out of bounds", + pcall_err(curwinmeths.text_height, { start_row = -6 })) + eq("Line index out of bounds", + pcall_err(curwinmeths.text_height, { end_row = 5 })) + eq("Line index out of bounds", + pcall_err(curwinmeths.text_height, { end_row = -6 })) + eq("'start_row' is higher than 'end_row'", + pcall_err(curwinmeths.text_height, { start_row = 3, end_row = 1 })) + eq("'start_vcol' specified without 'start_row'", + pcall_err(curwinmeths.text_height, { end_row = 2, start_vcol = 0 })) + eq("'end_vcol' specified without 'end_row'", + pcall_err(curwinmeths.text_height, { start_row = 2, end_vcol = 0 })) + eq("Invalid 'start_vcol': out of range", + pcall_err(curwinmeths.text_height, { start_row = 2, start_vcol = -1 })) + eq("Invalid 'start_vcol': out of range", + pcall_err(curwinmeths.text_height, { start_row = 2, start_vcol = X + 1 })) + eq("Invalid 'end_vcol': out of range", + pcall_err(curwinmeths.text_height, { end_row = 2, end_vcol = -1 })) + eq("Invalid 'end_vcol': out of range", + pcall_err(curwinmeths.text_height, { end_row = 2, end_vcol = X + 1 })) + eq("'start_vcol' is higher than 'end_vcol'", + pcall_err(curwinmeths.text_height, { start_row = 2, end_row = 2, start_vcol = 10, end_vcol = 5 })) + end) + + it('with two diff windows', function() + local X = meths.get_vvar('maxcol') + local screen = Screen.new(45, 22) + screen:set_default_attr_ids({ + [0] = {foreground = Screen.colors.Blue1, bold = true}; + [1] = {foreground = Screen.colors.Blue4, background = Screen.colors.Grey}; + [2] = {foreground = Screen.colors.Brown}; + [3] = {foreground = Screen.colors.Blue1, background = Screen.colors.LightCyan1, bold = true}; + [4] = {background = Screen.colors.LightBlue}; + [5] = {foreground = Screen.colors.Blue4, background = Screen.colors.LightGrey}; + [6] = {background = Screen.colors.Plum1}; + [7] = {background = Screen.colors.Red, bold = true}; + [8] = {reverse = true}; + [9] = {bold = true, reverse = true}; + }) + screen:attach() + exec([[ + set diffopt+=context:2 number + let expr = 'printf("%08d", v:val) .. repeat("!", v:val)' + call setline(1, map(range(1, 20) + range(25, 45), expr)) + vnew + call setline(1, map(range(3, 20) + range(28, 50), expr)) + windo diffthis + ]]) + feed('24gg') + screen:expect{grid=[[ + {1: }{2: }{3:----------------}│{1: }{2: 1 }{4:00000001! }| + {1: }{2: }{3:----------------}│{1: }{2: 2 }{4:00000002!! }| + {1: }{2: 1 }00000003!!! │{1: }{2: 3 }00000003!!! | + {1: }{2: 2 }00000004!!!! │{1: }{2: 4 }00000004!!!! | + {1:+ }{2: 3 }{5:+-- 14 lines: 00}│{1:+ }{2: 5 }{5:+-- 14 lines: 00}| + {1: }{2: 17 }00000019!!!!!!!!│{1: }{2: 19 }00000019!!!!!!!!| + {1: }{2: 18 }00000020!!!!!!!!│{1: }{2: 20 }00000020!!!!!!!!| + {1: }{2: }{3:----------------}│{1: }{2: 21 }{4:00000025!!!!!!!!}| + {1: }{2: }{3:----------------}│{1: }{2: 22 }{4:00000026!!!!!!!!}| + {1: }{2: }{3:----------------}│{1: }{2: 23 }{4:00000027!!!!!!!!}| + {1: }{2: 19 }00000028!!!!!!!!│{1: }{2: 24 }^00000028!!!!!!!!| + {1: }{2: 20 }00000029!!!!!!!!│{1: }{2: 25 }00000029!!!!!!!!| + {1:+ }{2: 21 }{5:+-- 14 lines: 00}│{1:+ }{2: 26 }{5:+-- 14 lines: 00}| + {1: }{2: 35 }00000044!!!!!!!!│{1: }{2: 40 }00000044!!!!!!!!| + {1: }{2: 36 }00000045!!!!!!!!│{1: }{2: 41 }00000045!!!!!!!!| + {1: }{2: 37 }{4:00000046!!!!!!!!}│{1: }{2: }{3:----------------}| + {1: }{2: 38 }{4:00000047!!!!!!!!}│{1: }{2: }{3:----------------}| + {1: }{2: 39 }{4:00000048!!!!!!!!}│{1: }{2: }{3:----------------}| + {1: }{2: 40 }{4:00000049!!!!!!!!}│{1: }{2: }{3:----------------}| + {1: }{2: 41 }{4:00000050!!!!!!!!}│{1: }{2: }{3:----------------}| + {8:[No Name] [+] }{9:[No Name] [+] }| + | + ]]} + screen:try_resize(45, 3) + screen:expect{grid=[[ + {1: }{2: 19 }00000028!!!!!!!!│{1: }{2: 24 }^00000028!!!!!!!!| + {8:[No Name] [+] }{9:[No Name] [+] }| + | + ]]} + eq(20, meths.win_text_height(1000, {})) + eq(20, meths.win_text_height(1001, {})) + eq(20, meths.win_text_height(1000, { start_row = 0 })) + eq(20, meths.win_text_height(1001, { start_row = 0 })) + eq(15, meths.win_text_height(1000, { end_row = -1 })) + eq(20, meths.win_text_height(1001, { end_row = -1 })) + eq(15, meths.win_text_height(1000, { end_row = 40 })) + eq(20, meths.win_text_height(1001, { end_row = 40 })) + eq(10, meths.win_text_height(1000, { start_row = 23 })) + eq(13, meths.win_text_height(1001, { start_row = 18 })) + eq(11, meths.win_text_height(1000, { end_row = 23 })) + eq(11, meths.win_text_height(1001, { end_row = 18 })) + eq(11, meths.win_text_height(1000, { start_row = 3, end_row = 39 })) + eq(11, meths.win_text_height(1001, { start_row = 1, end_row = 34 })) + eq(9, meths.win_text_height(1000, { start_row = 4, end_row = 38 })) + eq(9, meths.win_text_height(1001, { start_row = 2, end_row = 33 })) + eq(9, meths.win_text_height(1000, { start_row = 5, end_row = 37 })) + eq(9, meths.win_text_height(1001, { start_row = 3, end_row = 32 })) + eq(9, meths.win_text_height(1000, { start_row = 17, end_row = 25 })) + eq(9, meths.win_text_height(1001, { start_row = 15, end_row = 20 })) + eq(7, meths.win_text_height(1000, { start_row = 18, end_row = 24 })) + eq(7, meths.win_text_height(1001, { start_row = 16, end_row = 19 })) + eq(6, meths.win_text_height(1000, { start_row = -1 })) + eq(5, meths.win_text_height(1000, { start_row = -1, start_vcol = X })) + eq(0, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1 })) + eq(0, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1, end_vcol = X })) + eq(1, meths.win_text_height(1000, { start_row = -1, start_vcol = 0, end_row = -1, end_vcol = X })) + eq(3, meths.win_text_height(1001, { end_row = 0 })) + eq(2, meths.win_text_height(1001, { end_row = 0, end_vcol = 0 })) + eq(2, meths.win_text_height(1001, { start_row = 0, end_row = 0, end_vcol = 0 })) + eq(0, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = 0 })) + eq(1, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = X })) + eq(11, meths.win_text_height(1001, { end_row = 18 })) + eq(9, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18 })) + eq(10, meths.win_text_height(1001, { end_row = 18, end_vcol = 0 })) + eq(8, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18, end_vcol = 0 })) + end) + + it('with wrapped lines', function() + local X = meths.get_vvar('maxcol') + local screen = Screen.new(45, 22) + screen:set_default_attr_ids({ + [0] = {foreground = Screen.colors.Blue1, bold = true}; + [1] = {foreground = Screen.colors.Brown}; + [2] = {background = Screen.colors.Yellow}; + }) + screen:attach() + exec([[ + set number cpoptions+=n + call setline(1, repeat([repeat('foobar-', 36)], 3)) + ]]) + local ns = meths.create_namespace('') + meths.buf_set_extmark(0, ns, 1, 100, { virt_text = {{('?'):rep(15), 'Search'}}, virt_text_pos = 'inline' }) + meths.buf_set_extmark(0, ns, 2, 200, { virt_text = {{('!'):rep(75), 'Search'}}, virt_text_pos = 'inline' }) + screen:expect{grid=[[ + {1: 1 }^foobar-foobar-foobar-foobar-foobar-foobar| + -foobar-foobar-foobar-foobar-foobar-foobar-fo| + obar-foobar-foobar-foobar-foobar-foobar-fooba| + r-foobar-foobar-foobar-foobar-foobar-foobar-f| + oobar-foobar-foobar-foobar-foobar-foobar-foob| + ar-foobar-foobar-foobar-foobar- | + {1: 2 }foobar-foobar-foobar-foobar-foobar-foobar| + -foobar-foobar-foobar-foobar-foobar-foobar-fo| + obar-foobar-fo{2:???????????????}obar-foobar-foob| + ar-foobar-foobar-foobar-foobar-foobar-foobar-| + foobar-foobar-foobar-foobar-foobar-foobar-foo| + bar-foobar-foobar-foobar-foobar-foobar-foobar| + - | + {1: 3 }foobar-foobar-foobar-foobar-foobar-foobar| + -foobar-foobar-foobar-foobar-foobar-foobar-fo| + obar-foobar-foobar-foobar-foobar-foobar-fooba| + r-foobar-foobar-foobar-foobar-foobar-foobar-f| + oobar-foobar-foobar-foob{2:!!!!!!!!!!!!!!!!!!!!!}| + {2:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}| + {2:!!!!!!!!!}ar-foobar-foobar-foobar-foobar-fooba| + r-foobar-foobar- | + | + ]]} + screen:try_resize(45, 2) + screen:expect{grid=[[ + {1: 1 }^foobar-foobar-foobar-foobar-foobar-foobar| + | + ]]} + eq(21, meths.win_text_height(0, {})) + eq(6, meths.win_text_height(0, { start_row = 0, end_row = 0 })) + eq(7, meths.win_text_height(0, { start_row = 1, end_row = 1 })) + eq(8, meths.win_text_height(0, { start_row = 2, end_row = 2 })) + eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 41 })) + eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 42 })) + eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 86 })) + eq(3, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 87 })) + eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 266 })) + eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 267 })) + eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 311 })) + eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 312 })) + eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = X })) + eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 40, end_row = 1, end_vcol = X })) + eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 41, end_row = 1, end_vcol = X })) + eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 85, end_row = 1, end_vcol = X })) + eq(5, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = X })) + eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 265, end_row = 1, end_vcol = X })) + eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 266, end_row = 1, end_vcol = X })) + eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 310, end_row = 1, end_vcol = X })) + eq(0, meths.win_text_height(0, { start_row = 1, start_vcol = 311, end_row = 1, end_vcol = X })) + eq(18, meths.win_text_height(0, { start_row = 0, start_vcol = 131 })) + eq(19, meths.win_text_height(0, { start_row = 0, start_vcol = 130 })) + eq(20, meths.win_text_height(0, { end_row = 2, end_vcol = 311 })) + eq(21, meths.win_text_height(0, { end_row = 2, end_vcol = 312 })) + eq(17, meths.win_text_height(0, { start_row = 0, start_vcol = 131, end_row = 2, end_vcol = 311 })) + eq(19, meths.win_text_height(0, { start_row = 0, start_vcol = 130, end_row = 2, end_vcol = 312 })) + eq(16, meths.win_text_height(0, { start_row = 0, start_vcol = 221 })) + eq(17, meths.win_text_height(0, { start_row = 0, start_vcol = 220 })) + eq(14, meths.win_text_height(0, { end_row = 2, end_vcol = 41 })) + eq(15, meths.win_text_height(0, { end_row = 2, end_vcol = 42 })) + eq(9, meths.win_text_height(0, { start_row = 0, start_vcol = 221, end_row = 2, end_vcol = 41 })) + eq(11, meths.win_text_height(0, { start_row = 0, start_vcol = 220, end_row = 2, end_vcol = 42 })) + end) + end) + describe('open_win', function() it('noautocmd option works', function() command('autocmd BufEnter,BufLeave,BufWinEnter * let g:fired = 1') -- cgit From abe39f2b243dc813456225a779fbeb7ae6affc27 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Jul 2023 18:02:53 +0800 Subject: feat(api)!: change return type of nvim_win_text_height to Dict (#24365) --- test/functional/api/window_spec.lua | 141 ++++++++++++++++++------------------ 1 file changed, 72 insertions(+), 69 deletions(-) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 8038a84139..19511f30f1 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -687,42 +687,42 @@ describe('API/win', function() {8:[No Name] [+] }{9:[No Name] [+] }| | ]]} - eq(20, meths.win_text_height(1000, {})) - eq(20, meths.win_text_height(1001, {})) - eq(20, meths.win_text_height(1000, { start_row = 0 })) - eq(20, meths.win_text_height(1001, { start_row = 0 })) - eq(15, meths.win_text_height(1000, { end_row = -1 })) - eq(20, meths.win_text_height(1001, { end_row = -1 })) - eq(15, meths.win_text_height(1000, { end_row = 40 })) - eq(20, meths.win_text_height(1001, { end_row = 40 })) - eq(10, meths.win_text_height(1000, { start_row = 23 })) - eq(13, meths.win_text_height(1001, { start_row = 18 })) - eq(11, meths.win_text_height(1000, { end_row = 23 })) - eq(11, meths.win_text_height(1001, { end_row = 18 })) - eq(11, meths.win_text_height(1000, { start_row = 3, end_row = 39 })) - eq(11, meths.win_text_height(1001, { start_row = 1, end_row = 34 })) - eq(9, meths.win_text_height(1000, { start_row = 4, end_row = 38 })) - eq(9, meths.win_text_height(1001, { start_row = 2, end_row = 33 })) - eq(9, meths.win_text_height(1000, { start_row = 5, end_row = 37 })) - eq(9, meths.win_text_height(1001, { start_row = 3, end_row = 32 })) - eq(9, meths.win_text_height(1000, { start_row = 17, end_row = 25 })) - eq(9, meths.win_text_height(1001, { start_row = 15, end_row = 20 })) - eq(7, meths.win_text_height(1000, { start_row = 18, end_row = 24 })) - eq(7, meths.win_text_height(1001, { start_row = 16, end_row = 19 })) - eq(6, meths.win_text_height(1000, { start_row = -1 })) - eq(5, meths.win_text_height(1000, { start_row = -1, start_vcol = X })) - eq(0, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1 })) - eq(0, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1, end_vcol = X })) - eq(1, meths.win_text_height(1000, { start_row = -1, start_vcol = 0, end_row = -1, end_vcol = X })) - eq(3, meths.win_text_height(1001, { end_row = 0 })) - eq(2, meths.win_text_height(1001, { end_row = 0, end_vcol = 0 })) - eq(2, meths.win_text_height(1001, { start_row = 0, end_row = 0, end_vcol = 0 })) - eq(0, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = 0 })) - eq(1, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = X })) - eq(11, meths.win_text_height(1001, { end_row = 18 })) - eq(9, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18 })) - eq(10, meths.win_text_height(1001, { end_row = 18, end_vcol = 0 })) - eq(8, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18, end_vcol = 0 })) + eq({ all = 20, fill = 5 }, meths.win_text_height(1000, {})) + eq({ all = 20, fill = 5 }, meths.win_text_height(1001, {})) + eq({ all = 20, fill = 5 }, meths.win_text_height(1000, { start_row = 0 })) + eq({ all = 20, fill = 5 }, meths.win_text_height(1001, { start_row = 0 })) + eq({ all = 15, fill = 0 }, meths.win_text_height(1000, { end_row = -1 })) + eq({ all = 15, fill = 0 }, meths.win_text_height(1000, { end_row = 40 })) + eq({ all = 20, fill = 5 }, meths.win_text_height(1001, { end_row = -1 })) + eq({ all = 20, fill = 5 }, meths.win_text_height(1001, { end_row = 40 })) + eq({ all = 10, fill = 5 }, meths.win_text_height(1000, { start_row = 23 })) + eq({ all = 13, fill = 3 }, meths.win_text_height(1001, { start_row = 18 })) + eq({ all = 11, fill = 0 }, meths.win_text_height(1000, { end_row = 23 })) + eq({ all = 11, fill = 5 }, meths.win_text_height(1001, { end_row = 18 })) + eq({ all = 11, fill = 0 }, meths.win_text_height(1000, { start_row = 3, end_row = 39 })) + eq({ all = 11, fill = 3 }, meths.win_text_height(1001, { start_row = 1, end_row = 34 })) + eq({ all = 9, fill = 0 }, meths.win_text_height(1000, { start_row = 4, end_row = 38 })) + eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 2, end_row = 33 })) + eq({ all = 9, fill = 0 }, meths.win_text_height(1000, { start_row = 5, end_row = 37 })) + eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 3, end_row = 32 })) + eq({ all = 9, fill = 0 }, meths.win_text_height(1000, { start_row = 17, end_row = 25 })) + eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 15, end_row = 20 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(1000, { start_row = 18, end_row = 24 })) + eq({ all = 7, fill = 3 }, meths.win_text_height(1001, { start_row = 16, end_row = 19 })) + eq({ all = 6, fill = 5 }, meths.win_text_height(1000, { start_row = -1 })) + eq({ all = 5, fill = 5 }, meths.win_text_height(1000, { start_row = -1, start_vcol = X })) + eq({ all = 0, fill = 0 }, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1 })) + eq({ all = 0, fill = 0 }, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1, end_vcol = X })) + eq({ all = 1, fill = 0 }, meths.win_text_height(1000, { start_row = -1, start_vcol = 0, end_row = -1, end_vcol = X })) + eq({ all = 3, fill = 2 }, meths.win_text_height(1001, { end_row = 0 })) + eq({ all = 2, fill = 2 }, meths.win_text_height(1001, { end_row = 0, end_vcol = 0 })) + eq({ all = 2, fill = 2 }, meths.win_text_height(1001, { start_row = 0, end_row = 0, end_vcol = 0 })) + eq({ all = 0, fill = 0 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = 0 })) + eq({ all = 1, fill = 0 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = X })) + eq({ all = 11, fill = 5 }, meths.win_text_height(1001, { end_row = 18 })) + eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18 })) + eq({ all = 10, fill = 5 }, meths.win_text_height(1001, { end_row = 18, end_vcol = 0 })) + eq({ all = 8, fill = 3 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18, end_vcol = 0 })) end) it('with wrapped lines', function() @@ -770,39 +770,42 @@ describe('API/win', function() {1: 1 }^foobar-foobar-foobar-foobar-foobar-foobar| | ]]} - eq(21, meths.win_text_height(0, {})) - eq(6, meths.win_text_height(0, { start_row = 0, end_row = 0 })) - eq(7, meths.win_text_height(0, { start_row = 1, end_row = 1 })) - eq(8, meths.win_text_height(0, { start_row = 2, end_row = 2 })) - eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 41 })) - eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 42 })) - eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 86 })) - eq(3, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 87 })) - eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 266 })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 267 })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 311 })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 312 })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = X })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 40, end_row = 1, end_vcol = X })) - eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 41, end_row = 1, end_vcol = X })) - eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 85, end_row = 1, end_vcol = X })) - eq(5, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = X })) - eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 265, end_row = 1, end_vcol = X })) - eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 266, end_row = 1, end_vcol = X })) - eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 310, end_row = 1, end_vcol = X })) - eq(0, meths.win_text_height(0, { start_row = 1, start_vcol = 311, end_row = 1, end_vcol = X })) - eq(18, meths.win_text_height(0, { start_row = 0, start_vcol = 131 })) - eq(19, meths.win_text_height(0, { start_row = 0, start_vcol = 130 })) - eq(20, meths.win_text_height(0, { end_row = 2, end_vcol = 311 })) - eq(21, meths.win_text_height(0, { end_row = 2, end_vcol = 312 })) - eq(17, meths.win_text_height(0, { start_row = 0, start_vcol = 131, end_row = 2, end_vcol = 311 })) - eq(19, meths.win_text_height(0, { start_row = 0, start_vcol = 130, end_row = 2, end_vcol = 312 })) - eq(16, meths.win_text_height(0, { start_row = 0, start_vcol = 221 })) - eq(17, meths.win_text_height(0, { start_row = 0, start_vcol = 220 })) - eq(14, meths.win_text_height(0, { end_row = 2, end_vcol = 41 })) - eq(15, meths.win_text_height(0, { end_row = 2, end_vcol = 42 })) - eq(9, meths.win_text_height(0, { start_row = 0, start_vcol = 221, end_row = 2, end_vcol = 41 })) - eq(11, meths.win_text_height(0, { start_row = 0, start_vcol = 220, end_row = 2, end_vcol = 42 })) + eq({ all = 21, fill = 0 }, meths.win_text_height(0, {})) + eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 0, end_row = 0 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, end_row = 1 })) + eq({ all = 8, fill = 0 }, meths.win_text_height(0, { start_row = 2, end_row = 2 })) + eq({ all = 0, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 0 })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 41 })) + eq({ all = 2, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 42 })) + eq({ all = 2, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 86 })) + eq({ all = 3, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 87 })) + eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 266 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 267 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 311 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 312 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = X })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 40, end_row = 1, end_vcol = X })) + eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 41, end_row = 1, end_vcol = X })) + eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 85, end_row = 1, end_vcol = X })) + eq({ all = 5, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = X })) + eq({ all = 2, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 265, end_row = 1, end_vcol = X })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 266, end_row = 1, end_vcol = X })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 310, end_row = 1, end_vcol = X })) + eq({ all = 0, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 311, end_row = 1, end_vcol = X })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = 131 })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 221, end_row = 1, end_vcol = 266 })) + eq({ all = 18, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 131 })) + eq({ all = 19, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 130 })) + eq({ all = 20, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 311 })) + eq({ all = 21, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 312 })) + eq({ all = 17, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 131, end_row = 2, end_vcol = 311 })) + eq({ all = 19, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 130, end_row = 2, end_vcol = 312 })) + eq({ all = 16, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 221 })) + eq({ all = 17, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 220 })) + eq({ all = 14, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 41 })) + eq({ all = 15, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 42 })) + eq({ all = 9, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 221, end_row = 2, end_vcol = 41 })) + eq({ all = 11, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 220, end_row = 2, end_vcol = 42 })) end) end) -- cgit From 6b4970f6e0ac36021b2a8bd0533f5078040d31f7 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 23 Jul 2023 19:50:20 +0100 Subject: feat(api): allow open_win/win_set_buf in the cmdwin in some cases Problem: As discussed on Matrix, there was some interest in having `nvim_open_win` again be able to open floats in the cmdwin (e.g: displaying a hover doc related to what's in the cmdwin). After #23228, this was disallowed. Solution: Allow `nvim_open_win` in the cmdwin as long as `!enter` and `buffer != curbuf` (the former can cause all sorts of issues, and the latter can crash Nvim after closing cmdwin). Also allow `nvim_win_set_buf` in a similar fashion. Note that we're not *entirely* sure if this is 100% safe (cmdwin is a global-state-using-main-loop-calling beast), but this seems to work OK..? Also: - Check the buffer argument of `nvim_open_win` earlier, and abort if it's invalid (it used to still open a window in this case). - Untranslate `e_cmdwin` errors in the API (other errors in the API are not translated: although not detailed in the API contract yet, errors are supposed to be stable). --- test/functional/api/window_spec.lua | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 19511f30f1..e7e767817b 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -43,6 +43,22 @@ describe('API/win', function() eq('Invalid buffer id: 23', pcall_err(window, 'set_buf', nvim('get_current_win'), 23)) eq('Invalid window id: 23', pcall_err(window, 'set_buf', 23, nvim('get_current_buf'))) end) + + it('disallowed in cmdwin if win=curwin or buf=curbuf', function() + local new_buf = meths.create_buf(true, true) + local new_win = meths.open_win(new_buf, false, { + relative='editor', row=10, col=10, width=50, height=10, + }) + feed('q:') + eq('E11: Invalid in command-line window; executes, CTRL-C quits', + pcall_err(meths.win_set_buf, 0, new_buf)) + eq('E11: Invalid in command-line window; executes, CTRL-C quits', + pcall_err(meths.win_set_buf, new_win, 0)) + + local next_buf = meths.create_buf(true, true) + meths.win_set_buf(new_win, next_buf) + eq(next_buf, meths.win_get_buf(new_win)) + end) end) describe('{get,set}_cursor', function() @@ -821,6 +837,31 @@ describe('API/win', function() }) eq(1, funcs.exists('g:fired')) end) + + it('disallowed in cmdwin if enter=true or buf=curbuf', function() + local new_buf = meths.create_buf(true, true) + feed('q:') + eq('E11: Invalid in command-line window; executes, CTRL-C quits', + pcall_err(meths.open_win, new_buf, true, { + relative='editor', row=5, col=5, width=5, height=5, + })) + eq('E11: Invalid in command-line window; executes, CTRL-C quits', + pcall_err(meths.open_win, 0, false, { + relative='editor', row=5, col=5, width=5, height=5, + })) + + eq(new_buf, meths.win_get_buf(meths.open_win(new_buf, false, { + relative='editor', row=5, col=5, width=5, height=5, + }))) + end) + + it('aborts if buffer is invalid', function() + local wins_before = meths.list_wins() + eq('Invalid buffer id: 1337', pcall_err(meths.open_win, 1337, false, { + relative='editor', row=5, col=5, width=5, height=5, + })) + eq(wins_before, meths.list_wins()) + end) end) describe('get_config', function() -- cgit From 5d921e28c1cc33eced22bbfa823460ca241e3dc1 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 23 Jul 2023 23:10:28 +0100 Subject: feat(api): allow win_close in cmdwin to close wins except previous Disallow closing the previous window from `nvim_win_close`, as this will cause issues. Again, no telling how safe this is. It also requires exposing old_curwin. :/ Also note that it's possible for the `&cmdheight` to change if, for example, there are 2 tabpages and `nvim_win_close` is used to close the last window in the other tabpage while `&stal` is 1. This is addressed in a later commit. --- test/functional/api/window_spec.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index e7e767817b..74aaae0c6f 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -540,15 +540,21 @@ describe('API/win', function() command('split') eq(2, #meths.list_wins()) local oldwin = meths.get_current_win() + local otherwin = meths.open_win(0, false, { + relative='editor', row=10, col=10, width=10, height=10, + }) -- Open cmdline-window. feed('q:') - eq(3, #meths.list_wins()) + eq(4, #meths.list_wins()) eq(':', funcs.getcmdwintype()) - -- Vim: not allowed to close other windows from cmdline-window. + -- Not allowed to close previous window from cmdline-window. eq('E11: Invalid in command-line window; executes, CTRL-C quits', - pcall_err(meths.win_close, oldwin, true)) + pcall_err(meths.win_close, oldwin, true)) + -- Closing other windows is fine. + meths.win_close(otherwin, true) + eq(false, meths.win_is_valid(otherwin)) -- Close cmdline-window. - meths.win_close(0,true) + meths.win_close(0, true) eq(2, #meths.list_wins()) eq('', funcs.getcmdwintype()) end) -- cgit From 472271199e483d3f23d62c272b20c5290eec5474 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 24 Jul 2023 14:19:01 +0100 Subject: feat(api): allow win_hide to close cmdwin or non-previous windows This aligns its behaviour better with `nvim_win_close`. Note that `:hide` is actually incapable of closing the cmdwin, unlike `:close` and `:quit`, so this is a bit of a difference in behaviour. --- test/functional/api/window_spec.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 74aaae0c6f..00896a97d8 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -615,6 +615,24 @@ describe('API/win', function() eq({oldwin}, meths.list_wins()) eq({oldbuf}, meths.list_bufs()) end) + it('in the cmdwin', function() + feed('q:') + -- Can close the cmdwin. + meths.win_hide(0) + eq('', funcs.getcmdwintype()) + + local old_win = meths.get_current_win() + local other_win = meths.open_win(0, false, { + relative='win', row=3, col=3, width=12, height=3 + }) + feed('q:') + -- Cannot close the previous window. + eq('E11: Invalid in command-line window; executes, CTRL-C quits', + pcall_err(meths.win_hide, old_win)) + -- Can close other windows. + meths.win_hide(other_win) + eq(false, meths.win_is_valid(other_win)) + end) end) describe('text_height', function() -- cgit From 22d9338afceae5f8ef3845f152dea07a19d512d1 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Thu, 17 Aug 2023 00:53:10 +0100 Subject: fix(api): disallow win_set_buf from changing cmdwin's old curbuf (#24745) A command typed in the cmdwin and executed with `` is expected to be executed in the context of the old curwin/buf, so it shouldn't be changed. --- test/functional/api/window_spec.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 00896a97d8..44d4470337 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -44,14 +44,17 @@ describe('API/win', function() eq('Invalid window id: 23', pcall_err(window, 'set_buf', 23, nvim('get_current_buf'))) end) - it('disallowed in cmdwin if win=curwin or buf=curbuf', function() + it('disallowed in cmdwin if win={old_}curwin or buf=curbuf', function() local new_buf = meths.create_buf(true, true) + local old_win = meths.get_current_win() local new_win = meths.open_win(new_buf, false, { relative='editor', row=10, col=10, width=50, height=10, }) feed('q:') eq('E11: Invalid in command-line window; executes, CTRL-C quits', pcall_err(meths.win_set_buf, 0, new_buf)) + eq('E11: Invalid in command-line window; executes, CTRL-C quits', + pcall_err(meths.win_set_buf, old_win, new_buf)) eq('E11: Invalid in command-line window; executes, CTRL-C quits', pcall_err(meths.win_set_buf, new_win, 0)) -- cgit From b7763d7f6b7fdcabe06658c664457df8bc147563 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 22 Sep 2023 17:56:05 +0800 Subject: fix(api): get virtual text with multiple hl properly (#25307) --- test/functional/api/window_spec.lua | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 44d4470337..6737c2d15b 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -895,13 +895,14 @@ describe('API/win', function() it('includes border', function() local b = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' } local win = meths.open_win(0, true, { - relative='win', row=3, col=3, width=12, height=3, - border = b, + relative='win', row=3, col=3, width=12, height=3, + border = b, }) local cfg = meths.win_get_config(win) eq(b, cfg.border) end) + it('includes border with highlight group', function() local b = { {'a', 'Normal'}, @@ -914,12 +915,25 @@ describe('API/win', function() {'h', 'PreProc'}, } local win = meths.open_win(0, true, { - relative='win', row=3, col=3, width=12, height=3, - border = b, + relative='win', row=3, col=3, width=12, height=3, + border = b, }) local cfg = meths.win_get_config(win) eq(b, cfg.border) end) + + it('includes title and footer', function() + local title = { {'A', {'StatusLine', 'TabLine'}}, {'B'}, {'C', 'WinBar'} } + local footer = { {'A', 'WinBar'}, {'B'}, {'C', {'StatusLine', 'TabLine'}} } + local win = meths.open_win(0, true, { + relative='win', row=3, col=3, width=12, height=3, + border = 'single', title = title, footer = footer, + }) + + local cfg = meths.win_get_config(win) + eq(title, cfg.title) + eq(footer, cfg.footer) + end) end) end) -- cgit