diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 17:59:57 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 18:59:14 +0000 |
commit | 795f896a5772d5e0795f86642bdf90c82efac45c (patch) | |
tree | 308f04fbee18d2ec3f00c12a8bec96b84d8907f0 /test/functional/ui | |
parent | 4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e (diff) | |
download | rneovim-795f896a5772d5e0795f86642bdf90c82efac45c.tar.gz rneovim-795f896a5772d5e0795f86642bdf90c82efac45c.tar.bz2 rneovim-795f896a5772d5e0795f86642bdf90c82efac45c.zip |
test: rename (meths, funcs) -> (api, fn)
Diffstat (limited to 'test/functional/ui')
30 files changed, 1404 insertions, 1427 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua index 2cde0a8688..417a19f92c 100644 --- a/test/functional/ui/bufhl_spec.lua +++ b/test/functional/ui/bufhl_spec.lua @@ -3,10 +3,10 @@ local Screen = require('test.functional.ui.screen') local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local command, neq = helpers.command, helpers.neq -local meths = helpers.meths +local api = helpers.api local eq = helpers.eq local pcall_err = helpers.pcall_err -local set_virtual_text = meths.nvim_buf_set_virtual_text +local set_virtual_text = api.nvim_buf_set_virtual_text describe('Buffer highlighting', function() local screen @@ -40,8 +40,8 @@ describe('Buffer highlighting', function() }) end) - local add_highlight = meths.nvim_buf_add_highlight - local clear_namespace = meths.nvim_buf_clear_namespace + local add_highlight = api.nvim_buf_add_highlight + local clear_namespace = api.nvim_buf_clear_namespace it('works', function() insert([[ @@ -134,7 +134,7 @@ describe('Buffer highlighting', function() end) it('and clearing using deprecated name', function() - meths.nvim_buf_clear_highlight(0, id1, 0, -1) + api.nvim_buf_clear_highlight(0, id1, 0, -1) screen:expect([[ a {4:longer} example | in {6:order} to de{4:monstr}ate | @@ -494,16 +494,16 @@ describe('Buffer highlighting', function() end) it('respects priority', function() - local id = meths.nvim_create_namespace('') + local id = api.nvim_create_namespace('') insert [[foobar]] - meths.nvim_buf_set_extmark(0, id, 0, 0, { + api.nvim_buf_set_extmark(0, id, 0, 0, { end_line = 0, end_col = 5, hl_group = 'Statement', priority = 100, }) - meths.nvim_buf_set_extmark(0, id, 0, 0, { + api.nvim_buf_set_extmark(0, id, 0, 0, { end_line = 0, end_col = 6, hl_group = 'String', @@ -525,13 +525,13 @@ describe('Buffer highlighting', function() ]], } - meths.nvim_buf_set_extmark(0, id, 0, 0, { + api.nvim_buf_set_extmark(0, id, 0, 0, { end_line = 0, end_col = 6, hl_group = 'String', priority = 1, }) - meths.nvim_buf_set_extmark(0, id, 0, 0, { + api.nvim_buf_set_extmark(0, id, 0, 0, { end_line = 0, end_col = 5, hl_group = 'Statement', @@ -696,8 +696,8 @@ describe('Buffer highlighting', function() end) it('can be retrieved', function() - local get_extmarks = meths.nvim_buf_get_extmarks - local line_count = meths.nvim_buf_line_count + local get_extmarks = api.nvim_buf_get_extmarks + local line_count = api.nvim_buf_line_count local s1 = { { 'Köttbullar', 'Comment' }, { 'Kräuterbutter' } } local s2 = { { 'こんにちは', 'Comment' } } @@ -900,9 +900,9 @@ describe('Buffer highlighting', function() it('and virtual text use the same namespace counter', function() eq(1, add_highlight(0, 0, 'String', 0, 0, -1)) eq(2, set_virtual_text(0, 0, 0, { { '= text', 'Comment' } }, {})) - eq(3, meths.nvim_create_namespace('my-ns')) + eq(3, api.nvim_create_namespace('my-ns')) eq(4, add_highlight(0, 0, 'String', 0, 0, -1)) eq(5, set_virtual_text(0, 0, 0, { { '= text', 'Comment' } }, {})) - eq(6, meths.nvim_create_namespace('other-ns')) + eq(6, api.nvim_create_namespace('other-ns')) end) end) diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua index a26c529396..6c4000ba41 100644 --- a/test/functional/ui/cmdline_highlight_spec.lua +++ b/test/functional/ui/cmdline_highlight_spec.lua @@ -4,8 +4,8 @@ local Screen = require('test.functional.ui.screen') local eq = helpers.eq local feed = helpers.feed local clear = helpers.clear -local meths = helpers.meths -local funcs = helpers.funcs +local api = helpers.api +local fn = helpers.fn local source = helpers.source local exec_capture = helpers.exec_capture local dedent = helpers.dedent @@ -156,16 +156,16 @@ before_each(function() end) local function set_color_cb(funcname, callback_return, id) - meths.nvim_set_var('id', id or '') - if id and id ~= '' and funcs.exists('*' .. funcname .. 'N') then + api.nvim_set_var('id', id or '') + if id and id ~= '' and fn.exists('*' .. funcname .. 'N') then command(('let g:Nvim_color_input%s = {cmdline -> %sN(%s, cmdline)}'):format(id, funcname, id)) if callback_return then - meths.nvim_set_var('callback_return' .. id, callback_return) + api.nvim_set_var('callback_return' .. id, callback_return) end else - meths.nvim_set_var('Nvim_color_input', funcname) + api.nvim_set_var('Nvim_color_input', funcname) if callback_return then - meths.nvim_set_var('callback_return', callback_return) + api.nvim_set_var('callback_return', callback_return) end end end @@ -176,7 +176,7 @@ end describe('Command-line coloring', function() it('works', function() set_color_cb('RainBowParens') - meths.nvim_set_option_value('more', false, {}) + api.nvim_set_option_value('more', false, {}) start_prompt() screen:expect([[ | @@ -361,9 +361,9 @@ describe('Command-line coloring', function() | ]]) feed('\n') - eq('let x = "«»«»«»«»«»"', meths.nvim_get_var('out')) + eq('let x = "«»«»«»«»«»"', api.nvim_get_var('out')) local msg = '\nE5405: Chunk 0 start 10 splits multibyte character' - eq(msg:rep(1), funcs.execute('messages')) + eq(msg:rep(1), fn.execute('messages')) end) it('allows interrupting callback with <C-c>', function() set_color_cb('Halting') @@ -397,7 +397,7 @@ describe('Command-line coloring', function() :echo 42 | ]]) feed('\n') - eq('echo 42', meths.nvim_get_var('out')) + eq('echo 42', api.nvim_get_var('out')) feed('<C-c>') screen:expect([[ ^ | @@ -502,9 +502,9 @@ describe('Command-line coloring', function() ]])) eq( { '', ':', 'E888 detected for \\ze*', ':', 'E888 detected for \\zs*' }, - meths.nvim_buf_get_lines(0, 0, -1, false) + api.nvim_buf_get_lines(0, 0, -1, false) ) - eq('', funcs.execute('messages')) + eq('', fn.execute('messages')) end) it('allows nesting input()s', function() set_color_cb('ReturningGlobal', { { 0, 1, 'RBP1' } }, '') @@ -563,16 +563,16 @@ describe('Command-line coloring', function() {EOB:~ }|*6 | ]]) - eq('1234', meths.nvim_get_var('out')) - eq('234', meths.nvim_get_var('out1')) - eq('34', meths.nvim_get_var('out2')) - eq('4', meths.nvim_get_var('out3')) - eq(0, funcs.exists('g:out4')) + eq('1234', api.nvim_get_var('out')) + eq('234', api.nvim_get_var('out1')) + eq('34', api.nvim_get_var('out2')) + eq('4', api.nvim_get_var('out3')) + eq(0, fn.exists('g:out4')) end) it('runs callback with the same data only once', function() local function new_recording_calls(...) - eq({ ... }, meths.nvim_get_var('recording_calls')) - meths.nvim_set_var('recording_calls', {}) + eq({ ... }, api.nvim_get_var('recording_calls')) + api.nvim_set_var('recording_calls', {}) end set_color_cb('Recording') start_prompt('') @@ -593,7 +593,7 @@ describe('Command-line coloring', function() feed('<BS>') new_recording_calls() -- ('a') feed('<CR><CR>') - eq('', meths.nvim_get_var('out')) + eq('', api.nvim_get_var('out')) end) it('does not crash when callback has caught not-a-editor-command exception', function() source([[ @@ -608,12 +608,12 @@ describe('Command-line coloring', function() ]]) set_color_cb('CaughtExc') start_prompt('1') - eq(1, meths.nvim_eval('1')) + eq(1, api.nvim_eval('1')) end) end) describe('Ex commands coloring', function() it('works', function() - meths.nvim_set_var('Nvim_color_cmdline', 'RainBowParens') + api.nvim_set_var('Nvim_color_cmdline', 'RainBowParens') feed(':echo (((1)))') screen:expect([[ | @@ -622,11 +622,11 @@ describe('Ex commands coloring', function() ]]) end) it('still executes command-line even if errored out', function() - meths.nvim_set_var('Nvim_color_cmdline', 'SplitMultibyteStart') + api.nvim_set_var('Nvim_color_cmdline', 'SplitMultibyteStart') feed(':let x = "«"\n') - eq('«', meths.nvim_get_var('x')) + eq('«', api.nvim_get_var('x')) local msg = 'E5405: Chunk 0 start 10 splits multibyte character' - eq('\n' .. msg, funcs.execute('messages')) + eq('\n' .. msg, fn.execute('messages')) end) it('does not error out when called from a errorred out cycle', function() -- Apparently when there is a cycle in which one of the commands errors out @@ -645,9 +645,9 @@ describe('Ex commands coloring', function() ]])) eq( { '', 'E888 detected for \\ze*', 'E888 detected for \\zs*' }, - meths.nvim_buf_get_lines(0, 0, -1, false) + api.nvim_buf_get_lines(0, 0, -1, false) ) - eq('', funcs.execute('messages')) + eq('', fn.execute('messages')) end) it('does not crash when using `n` in debug mode', function() feed(':debug execute "echo 1"\n') @@ -708,7 +708,7 @@ describe('Ex commands coloring', function() ) end) it('errors out when failing to get callback', function() - meths.nvim_set_var('Nvim_color_cmdline', 42) + api.nvim_set_var('Nvim_color_cmdline', 42) feed(':#') screen:expect([[ | @@ -736,7 +736,7 @@ describe('Expressions coloring support', function() ]]) end) it('does not use Nvim_color_expr', function() - meths.nvim_set_var('Nvim_color_expr', 42) + api.nvim_set_var('Nvim_color_expr', 42) -- Used to error out due to failing to get callback. command('hi clear NvimNumber') command('hi NvimNumber guifg=Blue2') @@ -786,7 +786,7 @@ describe('Expressions coloring support', function() {EOB:~ }|*6 :^ | ]]) - funcs.setreg('a', { '\192' }) + fn.setreg('a', { '\192' }) feed('<C-r>="<C-r><C-r>a"<C-r><C-r>a"foo"') screen:expect([[ | diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 2670288cbb..40221269a8 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -9,7 +9,7 @@ local exec = helpers.exec local eval = helpers.eval local eq = helpers.eq local is_os = helpers.is_os -local meths = helpers.meths +local api = helpers.api local function new_screen(opt) local screen = Screen.new(25, 5) @@ -922,7 +922,7 @@ describe('cmdline redraw', function() it('with rightleftcmd', function() command('set rightleft rightleftcmd=search shortmess+=s') - meths.nvim_buf_set_lines(0, 0, -1, true, { "let's rock!" }) + api.nvim_buf_set_lines(0, 0, -1, true, { "let's rock!" }) screen:expect { grid = [[ !kcor s'te^l| @@ -1531,7 +1531,7 @@ describe('cmdheight=0', function() it('with multigrid', function() clear { args = { '--cmd', 'set cmdheight=0' } } screen:attach { ext_multigrid = true } - meths.nvim_buf_set_lines(0, 0, -1, true, { 'p' }) + api.nvim_buf_set_lines(0, 0, -1, true, { 'p' }) screen:expect { grid = [[ ## grid 1 @@ -1701,9 +1701,9 @@ describe('cmdheight=0', function() {1:~ }|*3 {3:[No Name] }| ]]) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 10) + api.nvim_input_mouse('left', 'press', '', 0, 6, 10) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 0, 5, 10) + api.nvim_input_mouse('left', 'drag', '', 0, 5, 10) screen:expect_unchanged() end) end) diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua index 601d242de0..8d58c11302 100644 --- a/test/functional/ui/cursor_spec.lua +++ b/test/functional/ui/cursor_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local clear, meths = helpers.clear, helpers.meths +local clear, api = helpers.clear, helpers.api local eq = helpers.eq local command = helpers.command @@ -299,7 +299,7 @@ describe('ui/cursor', function() } -- Another cursor style. - meths.nvim_set_option_value( + api.nvim_set_option_value( 'guicursor', 'n-v-c:ver35-blinkwait171-blinkoff172-blinkon173' .. ',ve:hor35,o:ver50,i-ci:block,r-cr:hor90,sm:ver42', @@ -326,7 +326,7 @@ describe('ui/cursor', function() end) -- If there is no setting for guicursor, it becomes the default setting. - meths.nvim_set_option_value( + api.nvim_set_option_value( 'guicursor', 'n:ver35-blinkwait171-blinkoff172-blinkon173-Cursor/lCursor', {} @@ -346,7 +346,7 @@ describe('ui/cursor', function() end) it("empty 'guicursor' sets cursor_shape=block in all modes", function() - meths.nvim_set_option_value('guicursor', '', {}) + api.nvim_set_option_value('guicursor', '', {}) screen:expect(function() -- Empty 'guicursor' sets enabled=false. eq(false, screen._cursor_style_enabled) diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 42c9c706d1..186bf19214 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -7,8 +7,8 @@ local insert = helpers.insert local exec_lua = helpers.exec_lua local exec = helpers.exec local expect_events = helpers.expect_events -local meths = helpers.meths -local funcs = helpers.funcs +local api = helpers.api +local fn = helpers.fn local command = helpers.command local eq = helpers.eq local assert_alive = helpers.assert_alive @@ -242,8 +242,8 @@ describe('decorations providers', function() ]]} -- spell=false with higher priority does disable spell - local ns = meths.nvim_create_namespace "spell" - local id = meths.nvim_buf_set_extmark(0, ns, 0, 0, { priority = 30, end_row = 2, end_col = 23, spell = false }) + local ns = api.nvim_create_namespace "spell" + local id = api.nvim_buf_set_extmark(0, ns, 0, 0, { priority = 30, end_row = 2, end_col = 23, spell = false }) screen:expect{grid=[[ I am well written text. | @@ -266,7 +266,7 @@ describe('decorations providers', function() command('echo ""') -- spell=false with lower priority doesn't disable spell - meths.nvim_buf_set_extmark(0, ns, 0, 0, { id = id, priority = 10, end_row = 2, end_col = 23, spell = false }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { id = id, priority = 10, end_row = 2, end_col = 23, spell = false }) screen:expect{grid=[[ I am well written text. | @@ -305,7 +305,7 @@ describe('decorations providers', function() LineNr = {italic=true, bg="Magenta"}; Comment = {fg="#FF0000", bg = 80*256+40}; CursorLine = {link="ErrorMsg"}; - } do meths.nvim_set_hl(ns1, k, v) end + } do api.nvim_set_hl(ns1, k, v) end screen:expect{grid=[[ {3: 1 }{4:// just to see if there was an accid}| @@ -326,7 +326,7 @@ describe('decorations providers', function() | ]]} - meths.nvim_set_hl_ns(ns1) + api.nvim_set_hl_ns(ns1) screen:expect{grid=[[ {10: 1 }{11:// just to see if there was an accid}| {10: }{11:ent} | @@ -386,7 +386,7 @@ describe('decorations providers', function() highlight link LinkGroup OriginalGroup ]] - meths.nvim_buf_set_virtual_text(0, 0, 2, {{'- not red', 'LinkGroup'}}, {}) + api.nvim_buf_set_virtual_text(0, 0, 2, {{'- not red', 'LinkGroup'}}, {}) screen:expect{grid=[[ // just to see if there was an accident | // on Mulholland Drive | @@ -398,8 +398,8 @@ describe('decorations providers', function() | ]]} - meths.nvim_set_hl(ns1, 'LinkGroup', {fg = 'Blue'}) - meths.nvim_set_hl_ns(ns1) + api.nvim_set_hl(ns1, 'LinkGroup', {fg = 'Blue'}) + api.nvim_set_hl_ns(ns1) screen:expect{grid=[[ // just to see if there was an accident | @@ -422,7 +422,7 @@ describe('decorations providers', function() highlight link LinkGroup OriginalGroup ]] - meths.nvim_buf_set_virtual_text(0, 0, 2, {{'- not red', 'LinkGroup'}}, {}) + api.nvim_buf_set_virtual_text(0, 0, 2, {{'- not red', 'LinkGroup'}}, {}) screen:expect{grid=[[ // just to see if there was an accident | // on Mulholland Drive | @@ -434,8 +434,8 @@ describe('decorations providers', function() | ]]} - meths.nvim_set_hl(ns1, 'LinkGroup', {fg = 'Blue', default=true}) - meths.nvim_set_hl_ns(ns1) + api.nvim_set_hl(ns1, 'LinkGroup', {fg = 'Blue', default=true}) + api.nvim_set_hl_ns(ns1) feed 'k' screen:expect{grid=[[ @@ -625,7 +625,7 @@ describe('decorations providers', function() end ]]) command([[autocmd CursorMoved * call line('w$')]]) - meths.nvim_win_set_cursor(0, {100, 0}) + api.nvim_win_set_cursor(0, {100, 0}) screen:expect([[ {14: }hello97 | {14: }hello98 | @@ -636,7 +636,7 @@ describe('decorations providers', function() {14: }hello103 | | ]]) - meths.nvim_win_set_cursor(0, {1, 0}) + api.nvim_win_set_cursor(0, {1, 0}) screen:expect([[ ^hello1 | hello2 | @@ -765,7 +765,7 @@ describe('extmark decorations', function() [43] = {background = Screen.colors.Yellow, undercurl = true, special = Screen.colors.Red}; } - ns = meths.nvim_create_namespace 'test' + ns = api.nvim_create_namespace 'test' end) it('empty virtual text at eol should not break colorcolumn #17860', function() @@ -788,7 +788,7 @@ describe('extmark decorations', function() {1:~ }|*2 | ]]) - meths.nvim_buf_set_extmark(0, ns, 4, 0, { virt_text={{''}}, virt_text_pos='eol'}) + api.nvim_buf_set_extmark(0, ns, 4, 0, { virt_text={{''}}, virt_text_pos='eol'}) screen:expect_unchanged() end) @@ -797,19 +797,19 @@ describe('extmark decorations', function() feed 'gg' for i = 1,9 do - meths.nvim_buf_set_extmark(0, ns, i, 0, { virt_text={{'|', 'LineNr'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, i, 0, { virt_text={{'|', 'LineNr'}}, virt_text_pos='overlay'}) if i == 3 or (i >= 6 and i <= 9) then - meths.nvim_buf_set_extmark(0, ns, i, 4, { virt_text={{'|', 'NonText'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, i, 4, { virt_text={{'|', 'NonText'}}, virt_text_pos='overlay'}) end end - meths.nvim_buf_set_extmark(0, ns, 9, 10, { virt_text={{'foo'}, {'bar', 'MoreMsg'}, {'!!', 'ErrorMsg'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, 9, 10, { virt_text={{'foo'}, {'bar', 'MoreMsg'}, {'!!', 'ErrorMsg'}}, virt_text_pos='overlay'}) -- can "float" beyond end of line - meths.nvim_buf_set_extmark(0, ns, 5, 28, { virt_text={{'loopy', 'ErrorMsg'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, 5, 28, { virt_text={{'loopy', 'ErrorMsg'}}, virt_text_pos='overlay'}) -- bound check: right edge of window - meths.nvim_buf_set_extmark(0, ns, 2, 26, { virt_text={{'bork bork bork'}, {(' bork'):rep(10), 'ErrorMsg'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, 2, 26, { virt_text={{'bork bork bork'}, {(' bork'):rep(10), 'ErrorMsg'}}, virt_text_pos='overlay'}) -- empty virt_text should not change anything - meths.nvim_buf_set_extmark(0, ns, 6, 16, { virt_text={{''}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, 6, 16, { virt_text={{''}}, virt_text_pos='overlay'}) screen:expect{grid=[[ ^for _,item in ipairs(items) do | @@ -858,12 +858,12 @@ describe('extmark decorations', function() ]]} -- truncating in the middle of a char leaves a space - meths.nvim_buf_set_lines(0, 0, 1, true, {'for _,item in ipairs(items) do -- 古古古'}) - meths.nvim_buf_set_lines(0, 10, 12, true, {' end -- ??????????', 'end -- ?古古古古?古古'}) - meths.nvim_buf_set_extmark(0, ns, 0, 35, { virt_text={{'A', 'ErrorMsg'}, {'AA'}}, virt_text_pos='overlay'}) - meths.nvim_buf_set_extmark(0, ns, 10, 19, { virt_text={{'口口口', 'ErrorMsg'}}, virt_text_pos='overlay'}) - meths.nvim_buf_set_extmark(0, ns, 11, 21, { virt_text={{'口口口', 'ErrorMsg'}}, virt_text_pos='overlay'}) - meths.nvim_buf_set_extmark(0, ns, 11, 8, { virt_text={{'口口', 'ErrorMsg'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_lines(0, 0, 1, true, {'for _,item in ipairs(items) do -- 古古古'}) + api.nvim_buf_set_lines(0, 10, 12, true, {' end -- ??????????', 'end -- ?古古古古?古古'}) + api.nvim_buf_set_extmark(0, ns, 0, 35, { virt_text={{'A', 'ErrorMsg'}, {'AA'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, 10, 19, { virt_text={{'口口口', 'ErrorMsg'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, 11, 21, { virt_text={{'口口口', 'ErrorMsg'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, 11, 8, { virt_text={{'口口', 'ErrorMsg'}}, virt_text_pos='overlay'}) screen:expect{grid=[[ ^for _,item in ipairs(i| tems) do -- {4:A}AA 古 | @@ -908,7 +908,7 @@ describe('extmark decorations', function() | ]]} - meths.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_clear_namespace(0, ns, 0, -1) screen:expect{grid=[[ ^for _,item in ipairs(items) do -- 古古古 | local text, hl_id_cell, count = unpack(item) | @@ -930,8 +930,8 @@ describe('extmark decorations', function() screen:try_resize(50, 6) insert(('ab'):rep(100)) for i = 0, 9 do - meths.nvim_buf_set_extmark(0, ns, 0, 42 + i, { virt_text={{tostring(i), 'ErrorMsg'}}, virt_text_pos='overlay'}) - meths.nvim_buf_set_extmark(0, ns, 0, 91 + i, { virt_text={{tostring(i), 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true}) + api.nvim_buf_set_extmark(0, ns, 0, 42 + i, { virt_text={{tostring(i), 'ErrorMsg'}}, virt_text_pos='overlay'}) + api.nvim_buf_set_extmark(0, ns, 0, 91 + i, { virt_text={{tostring(i), 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true}) end screen:expect{grid=[[ ababababababababababababababababababababab{4:01234567}| @@ -1027,9 +1027,9 @@ describe('extmark decorations', function() it('virt_text_hide hides overlay virtual text when extmark is off-screen', function() screen:try_resize(50, 3) command('set nowrap') - meths.nvim_buf_set_lines(0, 0, -1, true, {'-- ' .. ('…'):rep(57)}) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text={{'?????', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true}) - meths.nvim_buf_set_extmark(0, ns, 0, 123, { virt_text={{'!!!!!', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true}) + api.nvim_buf_set_lines(0, 0, -1, true, {'-- ' .. ('…'):rep(57)}) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text={{'?????', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true}) + api.nvim_buf_set_extmark(0, ns, 0, 123, { virt_text={{'!!!!!', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true}) screen:expect{grid=[[ {4:^?????}……………………………………………………………………………………………………{4:!!!!!}……| {1:~ }| @@ -1082,10 +1082,10 @@ describe('extmark decorations', function() it('overlay virtual text works on and after a TAB #24022', function() screen:try_resize(40, 3) - meths.nvim_buf_set_lines(0, 0, -1, true, {'\t\tline 1'}) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Search'}}, virt_text_pos = 'overlay', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 0, 1, { virt_text = {{'BB', 'Search'}}, virt_text_pos = 'overlay', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = {{'CC', 'Search'}}, virt_text_pos = 'overlay', hl_mode = 'combine' }) + api.nvim_buf_set_lines(0, 0, -1, true, {'\t\tline 1'}) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Search'}}, virt_text_pos = 'overlay', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 0, 1, { virt_text = {{'BB', 'Search'}}, virt_text_pos = 'overlay', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = {{'CC', 'Search'}}, virt_text_pos = 'overlay', hl_mode = 'combine' }) screen:expect{grid=[[ {34:AA} ^ {34:BB} {34:CC}ne 1 | {1:~ }| @@ -1124,13 +1124,13 @@ describe('extmark decorations', function() ]]} command 'hi Blendy guibg=Red blend=30' - meths.nvim_buf_set_extmark(0, ns, 1, 5, { virt_text={{'blendy text - here', 'Blendy'}}, virt_text_pos='overlay', hl_mode='blend'}) - meths.nvim_buf_set_extmark(0, ns, 2, 5, { virt_text={{'combining color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='combine'}) - meths.nvim_buf_set_extmark(0, ns, 3, 5, { virt_text={{'replacing color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='replace'}) + api.nvim_buf_set_extmark(0, ns, 1, 5, { virt_text={{'blendy text - here', 'Blendy'}}, virt_text_pos='overlay', hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 2, 5, { virt_text={{'combining color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='combine'}) + api.nvim_buf_set_extmark(0, ns, 3, 5, { virt_text={{'replacing color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='replace'}) - meths.nvim_buf_set_extmark(0, ns, 4, 5, { virt_text={{'blendy text - here', 'Blendy'}}, virt_text_pos='overlay', hl_mode='blend', virt_text_hide=true}) - meths.nvim_buf_set_extmark(0, ns, 5, 5, { virt_text={{'combining color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='combine', virt_text_hide=true}) - meths.nvim_buf_set_extmark(0, ns, 6, 5, { virt_text={{'replacing color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='replace', virt_text_hide=true}) + api.nvim_buf_set_extmark(0, ns, 4, 5, { virt_text={{'blendy text - here', 'Blendy'}}, virt_text_pos='overlay', hl_mode='blend', virt_text_hide=true}) + api.nvim_buf_set_extmark(0, ns, 5, 5, { virt_text={{'combining color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='combine', virt_text_hide=true}) + api.nvim_buf_set_extmark(0, ns, 6, 5, { virt_text={{'replacing color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='replace', virt_text_hide=true}) screen:expect{grid=[[ {5:^for} _,item {5:in} {6:ipairs}(items) {5:do} | @@ -1189,17 +1189,17 @@ describe('extmark decorations', function() it('can have virtual text of right_align and fixed win_col position', function() insert(example_text) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text={{'Very', 'ErrorMsg'}}, virt_text_win_col=31, hl_mode='blend'}) - meths.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text={{'VERY', 'ErrorMsg'}}, virt_text_pos='right_align', hl_mode='blend'}) - meths.nvim_buf_set_extmark(0, ns, 2, 10, { virt_text={{'Much', 'ErrorMsg'}}, virt_text_win_col=31, hl_mode='blend'}) - meths.nvim_buf_set_extmark(0, ns, 2, 10, { virt_text={{'MUCH', 'ErrorMsg'}}, virt_text_pos='right_align', hl_mode='blend'}) - meths.nvim_buf_set_extmark(0, ns, 3, 14, { virt_text={{'Error', 'ErrorMsg'}}, virt_text_win_col=31, hl_mode='blend'}) - meths.nvim_buf_set_extmark(0, ns, 3, 14, { virt_text={{'ERROR', 'ErrorMsg'}}, virt_text_pos='right_align', hl_mode='blend'}) - meths.nvim_buf_set_extmark(0, ns, 7, 21, { virt_text={{'-', 'NonText'}}, virt_text_win_col=4, hl_mode='blend'}) - meths.nvim_buf_set_extmark(0, ns, 7, 21, { virt_text={{'-', 'NonText'}}, virt_text_pos='right_align', hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text={{'Very', 'ErrorMsg'}}, virt_text_win_col=31, hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text={{'VERY', 'ErrorMsg'}}, virt_text_pos='right_align', hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 2, 10, { virt_text={{'Much', 'ErrorMsg'}}, virt_text_win_col=31, hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 2, 10, { virt_text={{'MUCH', 'ErrorMsg'}}, virt_text_pos='right_align', hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 3, 14, { virt_text={{'Error', 'ErrorMsg'}}, virt_text_win_col=31, hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 3, 14, { virt_text={{'ERROR', 'ErrorMsg'}}, virt_text_pos='right_align', hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 7, 21, { virt_text={{'-', 'NonText'}}, virt_text_win_col=4, hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 7, 21, { virt_text={{'-', 'NonText'}}, virt_text_pos='right_align', hl_mode='blend'}) -- empty virt_text should not change anything - meths.nvim_buf_set_extmark(0, ns, 8, 0, { virt_text={{''}}, virt_text_win_col=14, hl_mode='blend'}) - meths.nvim_buf_set_extmark(0, ns, 8, 0, { virt_text={{''}}, virt_text_pos='right_align', hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 8, 0, { virt_text={{''}}, virt_text_win_col=14, hl_mode='blend'}) + api.nvim_buf_set_extmark(0, ns, 8, 0, { virt_text={{''}}, virt_text_pos='right_align', hl_mode='blend'}) screen:expect{grid=[[ ^for _,item in ipairs(items) do | @@ -1293,7 +1293,7 @@ describe('extmark decorations', function() | ]]} - meths.nvim_buf_set_extmark(0, ns, 4, 50, { virt_text={{'EOL', 'NonText'}} }) + api.nvim_buf_set_extmark(0, ns, 4, 50, { virt_text={{'EOL', 'NonText'}} }) screen:expect{grid=[[ for _,item in ipairs(items) do | local text, hl_id_cell, cou{4:Very} unpack(ite{4:VERY}| @@ -1449,7 +1449,7 @@ describe('extmark decorations', function() it('virtual text win_col out of window does not break display #25645', function() screen:try_resize(51, 6) command('vnew') - meths.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 50) }) + api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 50) }) screen:expect{grid=[[ ^aaaaaaaaaaaaaaaaaaaaaaaaa│ | aaaaaaaaaaaaaaaaaaaaaaaaa│{1:~ }| @@ -1458,7 +1458,7 @@ describe('extmark decorations', function() | ]]} local extmark_opts = { virt_text_win_col = 35, virt_text = { { ' ', 'Comment' } } } - meths.nvim_buf_set_extmark(0, ns, 0, 0, extmark_opts) + api.nvim_buf_set_extmark(0, ns, 0, 0, extmark_opts) screen:expect_unchanged() assert_alive() end) @@ -1474,9 +1474,9 @@ describe('extmark decorations', function() -- XXX: the behavior of overlay virtual text at non-zero column is strange: -- 1. With 'wrap' it is never shown. -- 2. With 'nowrap' it is shown only if the extmark is hidden before leftcol. - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Underlined'}}, hl_mode = 'combine', virt_text_pos = 'overlay' }) - meths.nvim_buf_set_extmark(0, ns, 0, 5, { virt_text = {{'BB', 'Underlined'}}, hl_mode = 'combine', virt_text_win_col = 10 }) - meths.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = {{'CC', 'Underlined'}}, hl_mode = 'combine', virt_text_pos = 'right_align' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Underlined'}}, hl_mode = 'combine', virt_text_pos = 'overlay' }) + api.nvim_buf_set_extmark(0, ns, 0, 5, { virt_text = {{'BB', 'Underlined'}}, hl_mode = 'combine', virt_text_win_col = 10 }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = {{'CC', 'Underlined'}}, hl_mode = 'combine', virt_text_pos = 'right_align' }) screen:expect{grid=[[ {29:AA}{33:- 2 lin}{29:BB}{33:: 11111·····························}{29:CC}| 3333^3 | @@ -1519,9 +1519,9 @@ describe('extmark decorations', function() ddddd eeeee]]) command('windo diffthis') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Underlined'}}, virt_text_pos = 'overlay' }) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'BB', 'Underlined'}}, virt_text_win_col = 10 }) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'CC', 'Underlined'}}, virt_text_pos = 'right_align' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Underlined'}}, virt_text_pos = 'overlay' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'BB', 'Underlined'}}, virt_text_win_col = 10 }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'CC', 'Underlined'}}, virt_text_pos = 'right_align' }) screen:expect{grid=[[ {37: }{38:aaaaa }│{37: }{39:------------------------}| {37: }bbbbb │{37: }{28:AA}bbb {28:BB} {28:CC}| @@ -1564,10 +1564,10 @@ describe('extmark decorations', function() {'d', {'BgTwo', 'FgZwei'}}; {'X', {'BgTwo', 'FgZwei', 'VeryBold'}}; } - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'eol' }) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'right_align' }) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_lines = { vt, vt } }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'eol' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'right_align' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_lines = { vt, vt } }) screen:expect{grid=[[ {2:a}{3:b}{4:c}{5:d}{6:X}#^# {2:a}{3:b}{4:c}{5:d}{6:X} {2:a}{3:b}{4:c}{5:d}{6:X}| {2:a}{3:b}{4:c}{5:d}{6:X} |*2 @@ -1602,7 +1602,7 @@ describe('extmark decorations', function() it('conceal with conceal char #19007', function() screen:try_resize(50, 5) insert('foo\n') - meths.nvim_buf_set_extmark(0, ns, 0, 0, {end_col=0, end_row=2, conceal='X'}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {end_col=0, end_row=2, conceal='X'}) command('set conceallevel=2') screen:expect([[ {26:X} | @@ -1613,13 +1613,13 @@ describe('extmark decorations', function() command('set conceallevel=1') screen:expect_unchanged() - eq("conceal char has to be printable", pcall_err(meths.nvim_buf_set_extmark, 0, ns, 0, 0, {end_col=0, end_row=2, conceal='\255'})) + eq("conceal char has to be printable", pcall_err(api.nvim_buf_set_extmark, 0, ns, 0, 0, {end_col=0, end_row=2, conceal='\255'})) end) it('conceal with composed conceal char', function() screen:try_resize(50, 5) insert('foo\n') - meths.nvim_buf_set_extmark(0, ns, 0, 0, {end_col=0, end_row=2, conceal='ẍ̲'}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {end_col=0, end_row=2, conceal='ẍ̲'}) command('set conceallevel=2') screen:expect([[ {26:ẍ̲} | @@ -1631,7 +1631,7 @@ describe('extmark decorations', function() screen:expect_unchanged() -- this is rare, but could happen. Save at least the first codepoint - meths.nvim__invalidate_glyph_cache() + api.nvim__invalidate_glyph_cache() screen:expect{grid=[[ {26:x} | ^ | @@ -1643,7 +1643,7 @@ describe('extmark decorations', function() it('conceal without conceal char #24782', function() screen:try_resize(50, 5) insert('foobar\n') - meths.nvim_buf_set_extmark(0, ns, 0, 0, {end_col=3, conceal=''}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {end_col=3, conceal=''}) command('set listchars=conceal:?') command('let &conceallevel=1') screen:expect([[ @@ -1663,8 +1663,8 @@ describe('extmark decorations', function() it('conceal works just before truncated double-width char #21486', function() screen:try_resize(40, 4) - meths.nvim_buf_set_lines(0, 0, -1, true, {'', ('a'):rep(37) .. '<>古'}) - meths.nvim_buf_set_extmark(0, ns, 1, 37, {end_col=39, conceal=''}) + api.nvim_buf_set_lines(0, 0, -1, true, {'', ('a'):rep(37) .. '<>古'}) + api.nvim_buf_set_extmark(0, ns, 1, 37, {end_col=39, conceal=''}) command('setlocal conceallevel=2') screen:expect{grid=[[ ^ | @@ -1738,32 +1738,32 @@ describe('extmark decorations', function() [6] = {bold = true, undercurl = true, special = Screen.colors.Red}; }) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUL', priority = 20 }) - meths.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUC', priority = 30 }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUL', priority = 20 }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUC', priority = 30 }) screen:expect([[ {1:aaa}{4:bbb}{1:aa^a} | {0:~ }| | ]]) - meths.nvim_buf_clear_namespace(0, ns, 0, -1) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUC', priority = 20 }) - meths.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUL', priority = 30 }) + api.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUC', priority = 20 }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUL', priority = 30 }) screen:expect([[ {2:aaa}{3:bbb}{2:aa^a} | {0:~ }| | ]]) - meths.nvim_buf_clear_namespace(0, ns, 0, -1) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUL', priority = 30 }) - meths.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUC', priority = 20 }) + api.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUL', priority = 30 }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUC', priority = 20 }) screen:expect([[ {1:aaa}{3:bbb}{1:aa^a} | {0:~ }| | ]]) - meths.nvim_buf_clear_namespace(0, ns, 0, -1) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUC', priority = 30 }) - meths.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUL', priority = 20 }) + api.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUC', priority = 30 }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUL', priority = 20 }) screen:expect([[ {2:aaa}{4:bbb}{2:aa^a} | {0:~ }| @@ -1772,14 +1772,14 @@ describe('extmark decorations', function() -- When only one highlight group has an underline attribute, it should always take effect. for _, d in ipairs({-5, 5}) do - meths.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_clear_namespace(0, ns, 0, -1) screen:expect([[ aaabbbaa^a | {0:~ }| | ]]) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUL', priority = 25 + d }) - meths.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestBold', priority = 25 - d }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUL', priority = 25 + d }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestBold', priority = 25 - d }) screen:expect([[ {1:aaa}{5:bbb}{1:aa^a} | {0:~ }| @@ -1787,14 +1787,14 @@ describe('extmark decorations', function() ]]) end for _, d in ipairs({-5, 5}) do - meths.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_clear_namespace(0, ns, 0, -1) screen:expect([[ aaabbbaa^a | {0:~ }| | ]]) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUC', priority = 25 + d }) - meths.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestBold', priority = 25 - d }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUC', priority = 25 + d }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestBold', priority = 25 - d }) screen:expect([[ {2:aaa}{6:bbb}{2:aa^a} | {0:~ }| @@ -1811,10 +1811,10 @@ describe('extmark decorations', function() feed('gg') command('set ft=lua') command('syntax on') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 3, hl_mode = 'combine', hl_group = 'Visual' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 3, hl_mode = 'combine', hl_group = 'Visual' }) command('hi default MyLine gui=underline') command('sign define CurrentLine linehl=MyLine') - funcs.sign_place(6, 'Test', 'CurrentLine', '', { lnum = 1 }) + fn.sign_place(6, 'Test', 'CurrentLine', '', { lnum = 1 }) screen:expect{grid=[[ {30:^fun}{31:ction}{32: Func() }| {6:end} | @@ -1825,8 +1825,8 @@ describe('extmark decorations', function() it('highlight works after TAB with sidescroll #14201', function() screen:try_resize(50, 3) command('set nowrap') - meths.nvim_buf_set_lines(0, 0, -1, true, {'\tword word word word'}) - meths.nvim_buf_set_extmark(0, ns, 0, 1, { end_col = 3, hl_group = 'ErrorMsg' }) + api.nvim_buf_set_lines(0, 0, -1, true, {'\tword word word word'}) + api.nvim_buf_set_extmark(0, ns, 0, 1, { end_col = 3, hl_group = 'ErrorMsg' }) screen:expect{grid=[[ ^ {4:wo}rd word word word | {1:~ }| @@ -1854,16 +1854,16 @@ describe('extmark decorations', function() it('highlights the beginning of a TAB char correctly #23734', function() screen:try_resize(50, 3) - meths.nvim_buf_set_lines(0, 0, -1, true, {'this is the\ttab'}) - meths.nvim_buf_set_extmark(0, ns, 0, 11, { end_col = 15, hl_group = 'ErrorMsg' }) + api.nvim_buf_set_lines(0, 0, -1, true, {'this is the\ttab'}) + api.nvim_buf_set_extmark(0, ns, 0, 11, { end_col = 15, hl_group = 'ErrorMsg' }) screen:expect{grid=[[ ^this is the{4: tab} | {1:~ }| | ]]} - meths.nvim_buf_clear_namespace(0, ns, 0, -1) - meths.nvim_buf_set_extmark(0, ns, 0, 12, { end_col = 15, hl_group = 'ErrorMsg' }) + api.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_set_extmark(0, ns, 0, 12, { end_col = 15, hl_group = 'ErrorMsg' }) screen:expect{grid=[[ ^this is the {4:tab} | {1:~ }| @@ -1873,10 +1873,10 @@ describe('extmark decorations', function() it('highlight applies to a full TAB on line with matches #20885', function() screen:try_resize(50, 3) - meths.nvim_buf_set_lines(0, 0, -1, true, {'\t-- match1', ' -- match2'}) - funcs.matchadd('Underlined', 'match') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_row = 1, end_col = 0, hl_group = 'Visual' }) - meths.nvim_buf_set_extmark(0, ns, 1, 0, { end_row = 2, end_col = 0, hl_group = 'Visual' }) + api.nvim_buf_set_lines(0, 0, -1, true, {'\t-- match1', ' -- match2'}) + fn.matchadd('Underlined', 'match') + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_row = 1, end_col = 0, hl_group = 'Visual' }) + api.nvim_buf_set_extmark(0, ns, 1, 0, { end_row = 2, end_col = 0, hl_group = 'Visual' }) screen:expect{grid=[[ {18: ^ -- }{29:match}{18:1} | {18: -- }{29:match}{18:2} | @@ -1886,8 +1886,8 @@ describe('extmark decorations', function() pending('highlight applies to a full TAB in visual block mode', function() screen:try_resize(50, 8) - meths.nvim_buf_set_lines(0, 0, -1, true, {'asdf', '\tasdf', '\tasdf', '\tasdf', 'asdf'}) - meths.nvim_buf_set_extmark(0, ns, 0, 0, {end_row = 5, end_col = 0, hl_group = 'Underlined'}) + api.nvim_buf_set_lines(0, 0, -1, true, {'asdf', '\tasdf', '\tasdf', '\tasdf', 'asdf'}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {end_row = 5, end_col = 0, hl_group = 'Underlined'}) screen:expect([[ {28:^asdf} | {28: asdf} |*3 @@ -1908,7 +1908,7 @@ describe('extmark decorations', function() it('highlight works properly with multibyte text and spell #26771', function() insert('口口\n') screen:try_resize(50, 3) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 3, hl_group = 'Search' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 3, hl_group = 'Search' }) screen:expect([[ {34:口}口 | ^ | @@ -1927,7 +1927,7 @@ describe('extmark decorations', function() feed 'gg' for _,i in ipairs {1,2,3,5,6,7} do for _,j in ipairs {2,5,10,15} do - meths.nvim_buf_set_extmark(0, ns, i, j, { end_col=j+2, hl_group = 'NonText'}) + api.nvim_buf_set_extmark(0, ns, i, j, { end_col=j+2, hl_group = 'NonText'}) end end screen:expect{grid=[[ @@ -1959,7 +1959,7 @@ describe('extmark decorations', function() | ]]} - meths.nvim_buf_set_extmark(0, ns, 1, 0, { end_line=8, end_col=10, hl_group = 'ErrorMsg'}) + api.nvim_buf_set_extmark(0, ns, 1, 0, { end_line=8, end_col=10, hl_group = 'ErrorMsg'}) screen:expect{grid=[[ {4:^ }{36: }{4:f}{36:or}{4: _ }{36:= }{4:1, }{36:(c}{4:ount or 1) do} | {4: }{36: }{4: }{36: }{4: lo}{36:ca}{4:l c}{36:el}{4:l = line[colpos]} | @@ -1977,7 +1977,7 @@ describe('extmark decorations', function() screen:try_resize(50, 5) insert(example_text) feed'gg' - meths.nvim_buf_set_extmark(0, ns, 0, 6, { end_col=13, hl_group = 'NonText', undo_restore=val}) + api.nvim_buf_set_extmark(0, ns, 0, 6, { end_col=13, hl_group = 'NonText', undo_restore=val}) screen:expect{grid=[[ ^for _,{1:item in} ipairs(items) do | local text, hl_id_cell, count = unpack(item) | @@ -1986,7 +1986,7 @@ describe('extmark decorations', function() | ]]} - meths.nvim_buf_set_text(0, 0, 4, 0, 8, {''}) + api.nvim_buf_set_text(0, 0, 4, 0, 8, {''}) screen:expect{grid=[[ ^for {1:em in} ipairs(items) do | local text, hl_id_cell, count = unpack(item) | @@ -2024,7 +2024,7 @@ describe('extmark decorations', function() eq({ { 1, 0, 8, { end_col = 13, end_right_gravity = false, end_row = 0, hl_eol = false, hl_group = "NonText", undo_restore = false, ns_id = 1, priority = 4096, right_gravity = true } } }, - meths.nvim_buf_get_extmarks(0, ns, {0,0}, {0, -1}, {details=true})) + api.nvim_buf_get_extmarks(0, ns, {0,0}, {0, -1}, {details=true})) end) it('virtual text works with rightleft', function() @@ -2032,10 +2032,10 @@ describe('extmark decorations', function() insert('abcdefghijklmn') feed('0') command('set rightleft') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'EOL', 'Underlined'}}}) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'right_align', 'Underlined'}}, virt_text_pos = 'right_align' }) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'win_col', 'Underlined'}}, virt_text_win_col = 20 }) - meths.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = {{'overlayed', 'Underlined'}}, virt_text_pos = 'overlay' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'EOL', 'Underlined'}}}) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'right_align', 'Underlined'}}, virt_text_pos = 'right_align' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'win_col', 'Underlined'}}, virt_text_win_col = 20 }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = {{'overlayed', 'Underlined'}}, virt_text_pos = 'overlay' }) screen:expect{grid=[[ {28:ngila_thgir} {28:loc_niw} {28:LOE} nml{28:deyalrevo}b^a| {1: ~}| @@ -2085,7 +2085,7 @@ describe('extmark decorations', function() screen:try_resize(50, 3) insert('abcdefghij口klmnopqrstu口vwx口yz') feed('0') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'!!!!!', 'Underlined'}}, virt_text_win_col = 11 }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'!!!!!', 'Underlined'}}, virt_text_win_col = 11 }) screen:expect{grid=[[ ^abcdefghij {28:!!!!!}opqrstu口vwx口yz | {1:~ }| @@ -2116,7 +2116,7 @@ describe('extmark decorations', function() insert('abcdefghij口klmnopqrstu口vwx口yz') feed('0') command('hi Blendy guibg=Red blend=30') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{' ! ! ', 'Blendy'}}, virt_text_win_col = 8, hl_mode = 'blend' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{' ! ! ', 'Blendy'}}, virt_text_win_col = 8, hl_mode = 'blend' }) screen:expect{grid=[[ ^abcdefgh{10:i}{7:!}{10:口}{7:!}{10:l}mnopqrstu口vwx口yz | {1:~ }| @@ -2158,10 +2158,10 @@ describe('extmark decorations', function() {1: ~}| | ]]} - meths.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = {{'overlayed', 'Underlined'}}, virt_text_pos = 'overlay' }) - meths.nvim_buf_set_extmark(0, ns, 0, 14, { virt_text = {{'古', 'Underlined'}}, virt_text_pos = 'overlay' }) - meths.nvim_buf_set_extmark(0, ns, 0, 20, { virt_text = {{'\t', 'Underlined'}}, virt_text_pos = 'overlay' }) - meths.nvim_buf_set_extmark(0, ns, 0, 29, { virt_text = {{'古', 'Underlined'}}, virt_text_pos = 'overlay' }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = {{'overlayed', 'Underlined'}}, virt_text_pos = 'overlay' }) + api.nvim_buf_set_extmark(0, ns, 0, 14, { virt_text = {{'古', 'Underlined'}}, virt_text_pos = 'overlay' }) + api.nvim_buf_set_extmark(0, ns, 0, 20, { virt_text = {{'\t', 'Underlined'}}, virt_text_pos = 'overlay' }) + api.nvim_buf_set_extmark(0, ns, 0, 29, { virt_text = {{'古', 'Underlined'}}, virt_text_pos = 'overlay' }) screen:expect{grid=[[ zy {28:古}wv {28: }qpon{28:古}k {28:deyalrevo}b^a| {1: ~}| @@ -2172,7 +2172,7 @@ describe('extmark decorations', function() it('works with both hl_group and sign_hl_group', function() screen:try_resize(screen._width, 3) insert('abcdefghijklmn') - meths.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text='S', sign_hl_group='NonText', hl_group='Error', end_col=14}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text='S', sign_hl_group='NonText', hl_group='Error', end_col=14}) screen:expect{grid=[[ {1:S }{4:abcdefghijklm^n} | {1:~ }| @@ -2182,10 +2182,10 @@ describe('extmark decorations', function() it('virt_text_repeat_linebreak repeats virtual text on wrapped lines', function() screen:try_resize(40, 5) - meths.nvim_set_option_value('breakindent', true, {}) + api.nvim_set_option_value('breakindent', true, {}) insert(example_text) - meths.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_pos = 'overlay', virt_text_repeat_linebreak = true }) - meths.nvim_buf_set_extmark(0, ns, 1, 3, { virt_text = {{'│', 'NonText'}}, virt_text_pos = 'overlay', virt_text_repeat_linebreak = true }) + api.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_pos = 'overlay', virt_text_repeat_linebreak = true }) + api.nvim_buf_set_extmark(0, ns, 1, 3, { virt_text = {{'│', 'NonText'}}, virt_text_pos = 'overlay', virt_text_repeat_linebreak = true }) command('norm gg') screen:expect{grid=[[ ^for _,item in ipairs(items) do | @@ -2194,9 +2194,9 @@ describe('extmark decorations', function() if hl_id_cell ~= nil then | | ]]} - meths.nvim_buf_clear_namespace(0, ns, 0, -1) - meths.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_repeat_linebreak = true, virt_text_win_col = 0 }) - meths.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_repeat_linebreak = true, virt_text_win_col = 2 }) + api.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_repeat_linebreak = true, virt_text_win_col = 0 }) + api.nvim_buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_repeat_linebreak = true, virt_text_win_col = 2 }) screen:expect{grid=[[ ^for _,item in ipairs(items) do | {1:│} {1:│} local text, hl_id_cell, count = unpa| @@ -2237,7 +2237,7 @@ describe('decorations: inline virtual text', function() [21] = {reverse = true, foreground = Screen.colors.SlateBlue} } - ns = meths.nvim_create_namespace 'test' + ns = api.nvim_create_namespace 'test' end) @@ -2258,7 +2258,7 @@ describe('decorations: inline virtual text', function() | ]]} - meths.nvim_buf_set_extmark(0, ns, 1, 14, {virt_text={{': ', 'Special'}, {'string', 'Type'}}, virt_text_pos='inline'}) + api.nvim_buf_set_extmark(0, ns, 1, 14, {virt_text={{': ', 'Special'}, {'string', 'Type'}}, virt_text_pos='inline'}) screen:expect{grid=[[ ^for _,item in ipairs(items) do | local text{10:: }{3:string}, hl_id_cell, count = unpack| @@ -2318,9 +2318,9 @@ describe('decorations: inline virtual text', function() | ]]} - meths.nvim_buf_set_extmark(0, ns, 0, 5, {virt_text={{''}, {''}}, virt_text_pos='inline'}) - meths.nvim_buf_set_extmark(0, ns, 1, 14, {virt_text={{''}, {': ', 'Special'}}, virt_text_pos='inline'}) - meths.nvim_buf_set_extmark(0, ns, 1, 48, {virt_text={{''}, {''}}, virt_text_pos='inline'}) + api.nvim_buf_set_extmark(0, ns, 0, 5, {virt_text={{''}, {''}}, virt_text_pos='inline'}) + api.nvim_buf_set_extmark(0, ns, 1, 14, {virt_text={{''}, {': ', 'Special'}}, virt_text_pos='inline'}) + api.nvim_buf_set_extmark(0, ns, 1, 48, {virt_text={{''}, {''}}, virt_text_pos='inline'}) screen:expect{grid=[[ ^for _,item in ipairs(items) do | local text{10:: }, hl_id_cell, count = unpack(item)| @@ -2334,7 +2334,7 @@ describe('decorations: inline virtual text', function() | ]]} - meths.nvim_buf_set_extmark(0, ns, 1, 14, {virt_text={{''}, {'string', 'Type'}}, virt_text_pos='inline'}) + api.nvim_buf_set_extmark(0, ns, 1, 14, {virt_text={{''}, {'string', 'Type'}}, virt_text_pos='inline'}) feed('V') screen:expect{grid=[[ ^f{7:or _,item in ipairs(items) do} | @@ -2366,8 +2366,8 @@ describe('decorations: inline virtual text', function() it('Normal mode "gM" command works properly', function() command([[call setline(1, '123456789')]]) - meths.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 0, 7, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 7, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) feed('gM') screen:expect{grid=[[ 12{10:bbb}34^567{10:bbb}89 | @@ -2379,8 +2379,8 @@ describe('decorations: inline virtual text', function() local function test_normal_gj_gk() screen:try_resize(60, 6) command([[call setline(1, repeat([repeat('a', 55)], 2))]]) - meths.nvim_buf_set_extmark(0, ns, 0, 40, { virt_text = { { ('b'):rep(10), 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 1, 40, { virt_text = { { ('b'):rep(10), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 40, { virt_text = { { ('b'):rep(10), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 1, 40, { virt_text = { { ('b'):rep(10), 'Special' } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{10:bbbbbbbbbb}aaaaaaaaaa| aaaaa | @@ -2458,8 +2458,8 @@ describe('decorations: inline virtual text', function() it('cursor positions are correct with multiple inline virtual text', function() insert('12345678') - meths.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' }) feed '^' feed '4l' screen:expect{grid=[[ @@ -2472,7 +2472,7 @@ describe('decorations: inline virtual text', function() it('adjusts cursor location correctly when inserting around inline virtual text', function() insert('12345678') feed '$' - meths.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ 1234{10: virtual text }567^8 | @@ -2483,7 +2483,7 @@ describe('decorations: inline virtual text', function() it('has correct highlighting with multi-byte characters', function() insert('12345678') - meths.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { 'múlti-byté chñröcters 修补', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { 'múlti-byté chñröcters 修补', 'Special' } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ 1234{10:múlti-byté chñröcters 修补}567^8 | @@ -2494,7 +2494,7 @@ describe('decorations: inline virtual text', function() it('has correct cursor position when inserting around virtual text', function() insert('12345678') - meths.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) feed '^' feed '3l' feed 'a' @@ -2520,7 +2520,7 @@ describe('decorations: inline virtual text', function() end) it('has correct cursor position with virtual text on an empty line', function() - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ {10:^virtual text} | {1:~ }| @@ -2534,8 +2534,8 @@ describe('decorations: inline virtual text', function() call setline(1, ['', 'aaa', '', 'bbbbbb']) normal gg0 ]]) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('X', 60), 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 2, 0, { virt_text = { { string.rep('X', 61), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('X', 60), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 2, 0, { virt_text = { { string.rep('X', 61), 'Special' } }, virt_text_pos = 'inline' }) feed('$') screen:expect{grid=[[ {10:^XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}| @@ -2625,7 +2625,7 @@ describe('decorations: inline virtual text', function() feed('<TAB>') feed('test') feed('<ESC>') - meths.nvim_buf_set_extmark(0, ns, 0, 1, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 1, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) feed('0') screen:expect{grid=[[ ^ {10:virtual text} test | @@ -2666,7 +2666,7 @@ describe('decorations: inline virtual text', function() command('set linebreak') insert('one twoword') feed('0') - meths.nvim_buf_set_extmark(0, ns, 0, 3, { virt_text = { { ': virtual text', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { virt_text = { { ': virtual text', 'Special' } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ ^one{10:: virtual text} twoword | {1:~ }| @@ -2677,10 +2677,10 @@ describe('decorations: inline virtual text', function() it('search highlight is correct', function() insert('foo foo foo bar\nfoo foo foo bar') feed('gg0') - meths.nvim_buf_set_extmark(0, ns, 0, 9, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 0, 9, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 1, 9, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 1, 9, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) + api.nvim_buf_set_extmark(0, ns, 0, 9, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 9, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 1, 9, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 1, 9, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) screen:expect{grid=[[ ^foo foo f{10:AAABBB}oo bar | foo foo f{10:CCCDDD}oo bar | @@ -2694,7 +2694,7 @@ describe('decorations: inline virtual text', function() /foo^ | ]]} - meths.nvim_buf_set_extmark(0, ns, 0, 13, { virt_text = { { 'EEE', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 0, 13, { virt_text = { { 'EEE', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) feed('<C-G>') screen:expect{grid=[[ {12:foo} {12:foo} {13:f}{10:AAA}{21:BBB}{13:oo} b{10:EEE}ar | @@ -2706,10 +2706,10 @@ describe('decorations: inline virtual text', function() it('Visual select highlight is correct', function() insert('foo foo foo bar\nfoo foo foo bar') feed('gg0') - meths.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) + api.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) feed('8l') screen:expect{grid=[[ foo foo {10:AAABBB}^foo bar | @@ -2725,7 +2725,7 @@ describe('decorations: inline virtual text', function() {8:-- VISUAL BLOCK --} | ]]} - meths.nvim_buf_set_extmark(0, ns, 0, 10, { virt_text = { { 'EEE', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 0, 10, { virt_text = { { 'EEE', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) screen:expect{grid=[[ foo fo{7:o }{10:AAA}{20:BBB}{7:f}o{10:EEE}o bar | foo fo^o{7: }{20:CCC}{10:DDD}{7:f}oo bar | @@ -2735,12 +2735,12 @@ describe('decorations: inline virtual text', function() it('inside highlight range of another extmark', function() insert('foo foo foo bar\nfoo foo foo bar') - meths.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) - meths.nvim_buf_set_extmark(0, ns, 0, 4, { end_col = 11, hl_group = 'Search' }) - meths.nvim_buf_set_extmark(0, ns, 1, 4, { end_col = 11, hl_group = 'Search' }) + api.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) + api.nvim_buf_set_extmark(0, ns, 0, 4, { end_col = 11, hl_group = 'Search' }) + api.nvim_buf_set_extmark(0, ns, 1, 4, { end_col = 11, hl_group = 'Search' }) screen:expect{grid=[[ foo {12:foo }{10:AAA}{19:BBB}{12:foo} bar | foo {12:foo }{19:CCC}{10:DDD}{12:foo} ba^r | @@ -2750,10 +2750,10 @@ describe('decorations: inline virtual text', function() it('inside highlight range of syntax', function() insert('foo foo foo bar\nfoo foo foo bar') - meths.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) + api.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) command([[syntax match Search 'foo \zsfoo foo\ze bar']]) screen:expect{grid=[[ foo {12:foo }{10:AAA}{19:BBB}{12:foo} bar | @@ -2765,7 +2765,7 @@ describe('decorations: inline virtual text', function() it('cursor position is correct when inserting around a virtual text with left gravity', function() screen:try_resize(27, 4) insert(('a'):rep(15)) - meths.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { ('>'):rep(43), 'Special' } }, virt_text_pos = 'inline', right_gravity = false }) + api.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = { { ('>'):rep(43), 'Special' } }, virt_text_pos = 'inline', right_gravity = false }) command('setlocal showbreak=+ breakindent breakindentopt=shift:2') feed('08l') screen:expect{grid=[[ @@ -2836,8 +2836,8 @@ describe('decorations: inline virtual text', function() screen:try_resize(30, 4) command('setlocal showbreak=+ breakindent breakindentopt=shift:2') insert(('a'):rep(15)) - meths.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = {{ ('>'):rep(32), 'Special' }}, virt_text_pos = 'inline', right_gravity = false }) - meths.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = {{ ('<'):rep(32), 'Special' }}, virt_text_pos = 'inline', right_gravity = true }) + api.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = {{ ('>'):rep(32), 'Special' }}, virt_text_pos = 'inline', right_gravity = false }) + api.nvim_buf_set_extmark(0, ns, 0, 8, { virt_text = {{ ('<'):rep(32), 'Special' }}, virt_text_pos = 'inline', right_gravity = true }) feed('08l') screen:expect{grid=[[ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>>>>}| @@ -2934,8 +2934,8 @@ describe('decorations: inline virtual text', function() it('draws correctly with no wrap multiple virtual text, where one is hidden', function() insert('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz') command("set nowrap") - meths.nvim_buf_set_extmark(0, ns, 0, 50, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 50, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) feed('$') screen:expect{grid=[[ opqrstuvwxyzabcdefghijklmnopqrstuvwx{10:virtual text}y^z| @@ -2947,7 +2947,7 @@ describe('decorations: inline virtual text', function() it('draws correctly with no wrap and a long virtual text', function() insert('abcdefghi') command("set nowrap") - meths.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) feed('$') screen:expect{grid=[[ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}cdefgh^i| @@ -2959,7 +2959,7 @@ describe('decorations: inline virtual text', function() it('tabs are the correct length with no wrap following virtual text', function() command('set nowrap') feed('itest<TAB>a<ESC>') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('a', 55), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('a', 55), 'Special' } }, virt_text_pos = 'inline' }) feed('gg$') screen:expect{grid=[[ {10:aaaaaaaaaaaaaaaaaaaaaaaaa}test ^a | @@ -2971,7 +2971,7 @@ describe('decorations: inline virtual text', function() it('highlighting does not extend with no wrap and a long virtual text', function() insert('abcdef') command("set nowrap") - meths.nvim_buf_set_extmark(0, ns, 0, 3, { virt_text = { { string.rep('X', 50), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { virt_text = { { string.rep('X', 50), 'Special' } }, virt_text_pos = 'inline' }) feed('$') screen:expect{grid=[[ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}de^f| @@ -2983,7 +2983,7 @@ describe('decorations: inline virtual text', function() it('hidden virtual text does not interfere with Visual highlight', function() insert('abcdef') command('set nowrap') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'XXX', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'XXX', 'Special' } }, virt_text_pos = 'inline' }) feed('V2zl') screen:expect{grid=[[ {10:X}{7:abcde}^f | @@ -3010,7 +3010,7 @@ describe('decorations: inline virtual text', function() test test]]) command('set number') - meths.nvim_buf_set_extmark(0, ns, 0, 1, { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 1, { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) feed('gg0') screen:expect{grid=[[ {2: 1 }^t{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}| @@ -3023,7 +3023,7 @@ describe('decorations: inline virtual text', function() it('highlighting is correct when virtual text is proceeded with a match', function() insert([[test]]) - meths.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) feed('gg0') command('match ErrorMsg /e/') screen:expect{grid=[[ @@ -3041,7 +3041,7 @@ describe('decorations: inline virtual text', function() it('smoothscroll works correctly when virtual text wraps', function() insert('foobar') - meths.nvim_buf_set_extmark(0, ns, 0, 3, { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) command('setlocal smoothscroll') screen:expect{grid=[[ foo{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}| @@ -3067,9 +3067,9 @@ describe('decorations: inline virtual text', function() ]]) insert('aaa\tbbb') command("set diff") - meths.nvim_buf_set_extmark(0, ns, 0, 1, { virt_text = { { 'test', 'Special' } }, virt_text_pos = 'inline', right_gravity = false }) - meths.nvim_buf_set_extmark(0, ns, 5, 0, { virt_text = { { '!', 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 5, 3, { virt_text = { { '' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 1, { virt_text = { { 'test', 'Special' } }, virt_text_pos = 'inline', right_gravity = false }) + api.nvim_buf_set_extmark(0, ns, 5, 0, { virt_text = { { '!', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 5, 3, { virt_text = { { '' } }, virt_text_pos = 'inline' }) command("vnew") insert([[ 000 @@ -3108,8 +3108,8 @@ describe('decorations: inline virtual text', function() it('correctly draws when there are multiple overlapping virtual texts on the same line with nowrap', function() command('set nowrap') insert('a') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('a', 55), 'Special' } }, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('b', 55), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('a', 55), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('b', 55), 'Special' } }, virt_text_pos = 'inline' }) feed('$') screen:expect{grid=[[ {10:bbbbbbbbbbbbbbbbbbbbbbbbb}^a | @@ -3121,7 +3121,7 @@ describe('decorations: inline virtual text', function() it('correctly draws when overflowing virtual text is followed by TAB with no wrap', function() command('set nowrap') feed('i<TAB>test<ESC>') - meths.nvim_buf_set_extmark( 0, ns, 0, 0, { virt_text = { { string.rep('a', 60), 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark( 0, ns, 0, 0, { virt_text = { { string.rep('a', 60), 'Special' } }, virt_text_pos = 'inline' }) feed('0') screen:expect({grid=[[ {10:aaaaaaaaaaaaaaaaaaaaaa} ^ test | @@ -3139,8 +3139,8 @@ describe('decorations: inline virtual text', function() bbbbb ccccc]]) - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'foo'}}, virt_text_pos = 'inline' }) - meths.nvim_buf_set_extmark(0, ns, 2, 0, { virt_text = {{'bar'}}, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = {{'foo'}}, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 2, 0, { virt_text = {{'bar'}}, virt_text_pos = 'inline' }) screen:expect{grid=[[ fooaaaaa | bbbbb | @@ -3182,7 +3182,7 @@ describe('decorations: inline virtual text', function() it('does not crash at right edge of wide window #23848', function() screen:try_resize(82, 5) - meths.nvim_buf_set_extmark(0, ns, 0, 0, {virt_text = {{('a'):rep(82)}, {'b'}}, virt_text_pos = 'inline'}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {virt_text = {{('a'):rep(82)}, {'b'}}, virt_text_pos = 'inline'}) screen:expect{grid=[[ ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| b | @@ -3216,7 +3216,7 @@ describe('decorations: inline virtual text', function() setlocal nowrap list listchars=extends:! call setline(1, repeat('a', 51)) ]]) - meths.nvim_buf_set_extmark(0, ns, 0, 50, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 50, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) feed('20l') screen:expect{grid=[[ aaaaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:!}| @@ -3253,7 +3253,7 @@ describe('decorations: inline virtual text', function() command('set nowrap') command('set list') command('set listchars+=extends:c') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'test', 'Special' } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'test', 'Special' } }, virt_text_pos = 'inline' }) insert(string.rep('a', 50)) feed('gg0') screen:expect{grid=[[ @@ -3266,8 +3266,8 @@ describe('decorations: inline virtual text', function() it('blockwise Visual highlight with double-width virtual text (replace)', function() screen:try_resize(60, 6) insert('123456789\n123456789\n123456789\n123456789') - meths.nvim_buf_set_extmark(0, ns, 1, 1, { virt_text = { { '-口-', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) - meths.nvim_buf_set_extmark(0, ns, 2, 2, { virt_text = { { '口', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) + api.nvim_buf_set_extmark(0, ns, 1, 1, { virt_text = { { '-口-', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) + api.nvim_buf_set_extmark(0, ns, 2, 2, { virt_text = { { '口', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) feed('gg0') screen:expect{grid=[[ ^123456789 | @@ -3336,8 +3336,8 @@ describe('decorations: inline virtual text', function() it('blockwise Visual highlight with double-width virtual text (combine)', function() screen:try_resize(60, 6) insert('123456789\n123456789\n123456789\n123456789') - meths.nvim_buf_set_extmark(0, ns, 1, 1, { virt_text = { { '-口-', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.nvim_buf_set_extmark(0, ns, 2, 2, { virt_text = { { '口', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 1, 1, { virt_text = { { '-口-', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + api.nvim_buf_set_extmark(0, ns, 2, 2, { virt_text = { { '口', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) feed('gg0') screen:expect{grid=[[ ^123456789 | @@ -3412,7 +3412,7 @@ describe('decorations: inline virtual text', function() call setline(1, repeat('a', 28)) normal! $ ]]) - meths.nvim_buf_set_extmark(0, ns, 0, 27, { virt_text = { { ('123'):rep(23) } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 27, { virt_text = { { ('123'):rep(23) } }, virt_text_pos = 'inline' }) feed(':<CR>') -- Have a screen line that doesn't start with spaces screen:expect{grid=[[ 1 aaaaaaaaaaaaaaaaaaaaaaaaaa| @@ -3625,7 +3625,7 @@ describe('decorations: inline virtual text', function() call setline(1, repeat("\t", 4) .. 'a') normal! $ ]]) - meths.nvim_buf_set_extmark(0, ns, 0, 3, { virt_text = { { ('12'):rep(32) } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 3, { virt_text = { { ('12'):rep(32) } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ {1:<------><------><------>}121212| 121212121212121212121212121212| @@ -3721,7 +3721,7 @@ describe('decorations: inline virtual text', function() call setline(1, repeat('a', 50) .. ' ' .. repeat('c', 45)) normal! $ ]]) - meths.nvim_buf_set_extmark(0, ns, 0, 50, { virt_text = { { ('b'):rep(10) } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 50, { virt_text = { { ('b'):rep(10) } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {1:+}bbbbbbbbbb | @@ -3744,7 +3744,7 @@ describe('decorations: inline virtual text', function() call setline(1, repeat('a', 40) .. '口' .. '12345') normal! $ ]]) - meths.nvim_buf_set_extmark(0, ns, 0, 40, { virt_text = { { ('b'):rep(9) } }, virt_text_pos = 'inline' }) + api.nvim_buf_set_extmark(0, ns, 0, 40, { virt_text = { { ('b'):rep(9) } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbb{1:>}| 口1234^5 | @@ -3771,7 +3771,7 @@ describe('decorations: virtual lines', function() [9] = {foreground = Screen.colors.Brown}; } - ns = meths.nvim_create_namespace 'test' + ns = api.nvim_create_namespace 'test' end) local example_text2 = [[ @@ -3787,7 +3787,7 @@ if (h->n_buckets < new_n_buckets) { // expand it('works with one line', function() insert(example_text2) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 1, 33, { + api.nvim_buf_set_extmark(0, ns, 1, 33, { virt_lines={ {{">> ", "NonText"}, {"krealloc", "Identifier"}, {": change the size of an allocation"}}}; virt_lines_above=true; }) @@ -3856,7 +3856,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.nvim_buf_set_extmark(0, ns, 5, 0, { + api.nvim_buf_set_extmark(0, ns, 5, 0, { virt_lines = { {{"^^ REVIEW:", "Todo"}, {" new_vals variable seems unnecessary?", "Comment"}} }; }) -- TODO: what about the cursor?? @@ -3875,7 +3875,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_clear_namespace(0, ns, 0, -1) -- Cursor should be drawn on the correct line. #22704 screen:expect{grid=[[ if (h->n_buckets < new_n_buckets) { // expand | @@ -3912,7 +3912,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.nvim_buf_set_extmark(0, ns, 0, 0, { + api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_lines={ {{"refactor(khash): ", "Special"}, {"take size of values as parameter"}}; {{"Author: Dev Devsson, "}, {"Tue Aug 31 10:13:37 2021", "Comment"}}; @@ -3973,7 +3973,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - local id = meths.nvim_buf_set_extmark(0, ns, 7, 0, { + local id = api.nvim_buf_set_extmark(0, ns, 7, 0, { virt_lines={{{"Grugg"}}}; right_gravity=false; }) @@ -4056,7 +4056,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.nvim_buf_del_extmark(0, ns, id) + api.nvim_buf_del_extmark(0, ns, id) screen:expect{grid=[[ if (h->n_buckets < new_n_buckets) { // expand | khkey_t *new_keys = (khkey_t *)krealloc((void *)| @@ -4092,7 +4092,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - local id = meths.nvim_buf_set_extmark(0, ns, 8, 0, { + local id = api.nvim_buf_set_extmark(0, ns, 8, 0, { virt_lines={{{"Grugg"}}}; virt_lines_above = true, }) @@ -4150,7 +4150,7 @@ if (h->n_buckets < new_n_buckets) { // expand --No lines in buffer-- | ]]} - meths.nvim_buf_del_extmark(0, ns, id) + api.nvim_buf_del_extmark(0, ns, id) screen:expect{grid=[[ ^ | {1:~ }|*10 @@ -4162,7 +4162,7 @@ if (h->n_buckets < new_n_buckets) { // expand command([[syntax region foo keepend start='^foo' end='^$']]) command('syntax sync minlines=100') insert('foo') - meths.nvim_buf_set_extmark(0, ns, 0, 0, {virt_lines = {{{'bar', 'Comment'}}}}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {virt_lines = {{{'bar', 'Comment'}}}}) screen:expect([[ fo^o | {6:bar} | @@ -4176,7 +4176,7 @@ if (h->n_buckets < new_n_buckets) { // expand insert("aa\nbb\ncc\ndd\nee\nff\ngg\nhh") feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 6, 0, { + api.nvim_buf_set_extmark(0, ns, 6, 0, { virt_lines={ {{"they see me"}}; {{"scrolling", "Special"}}; @@ -4326,7 +4326,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - local markid = meths.nvim_buf_set_extmark(0, ns, 2, 0, { + local markid = api.nvim_buf_set_extmark(0, ns, 2, 0, { virt_lines={ {{"Some special", "Special"}}; {{"remark about codes", "Comment"}}; @@ -4348,7 +4348,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.nvim_buf_set_extmark(0, ns, 2, 0, { + api.nvim_buf_set_extmark(0, ns, 2, 0, { virt_lines={ {{"Some special", "Special"}}; {{"remark about codes", "Comment"}}; @@ -4376,7 +4376,7 @@ if (h->n_buckets < new_n_buckets) { // expand it('works with hard TABs', function() insert(example_text2) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 1, 0, { + api.nvim_buf_set_extmark(0, ns, 1, 0, { virt_lines={ {{">>", "NonText"}, {"\tvery\ttabby", "Identifier"}, {"text\twith\ttabs"}}}; }) screen:expect{grid=[[ @@ -4450,8 +4450,8 @@ if (h->n_buckets < new_n_buckets) { // expand bbb ccc ddd]]) - meths.nvim_buf_set_extmark(0, ns, 0, 0, {end_row = 2, virt_lines = {{{'VIRT LINE 1', 'NonText'}}}}) - meths.nvim_buf_set_extmark(0, ns, 3, 0, {end_col = 2, virt_lines = {{{'VIRT LINE 2', 'NonText'}}}}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {end_row = 2, virt_lines = {{{'VIRT LINE 1', 'NonText'}}}}) + api.nvim_buf_set_extmark(0, ns, 3, 0, {end_col = 2, virt_lines = {{{'VIRT LINE 2', 'NonText'}}}}) screen:expect{grid=[[ aaa | {1:VIRT LINE 1} | @@ -4472,8 +4472,8 @@ if (h->n_buckets < new_n_buckets) { // expand ccc ddd]]) command('set number rightleft') - meths.nvim_buf_set_extmark(0, ns, 0, 0, {virt_lines = {{{'VIRT LINE 1', 'NonText'}}}, virt_lines_leftcol = true}) - meths.nvim_buf_set_extmark(0, ns, 3, 0, {virt_lines = {{{'VIRT LINE 2', 'NonText'}}}}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {virt_lines = {{{'VIRT LINE 1', 'NonText'}}}, virt_lines_leftcol = true}) + api.nvim_buf_set_extmark(0, ns, 3, 0, {virt_lines = {{{'VIRT LINE 2', 'NonText'}}}}) screen:expect{grid=[[ aaa{9: 1 }| {1:1 ENIL TRIV}| @@ -4493,7 +4493,7 @@ if (h->n_buckets < new_n_buckets) { // expand line3 line4 line5]]) - meths.nvim_buf_set_extmark(0, ns, 0, 0, {virt_lines={{{"foo"}}, {{"bar"}}, {{"baz"}}}}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {virt_lines={{{"foo"}}, {{"bar"}}, {{"baz"}}}}) screen:expect{grid=[[ line1 | foo | @@ -4550,8 +4550,8 @@ describe('decorations: signs', function() [3] = {background = Screen.colors.Yellow1, foreground = Screen.colors.Blue1}; } - ns = meths.nvim_create_namespace 'test' - meths.nvim_set_option_value('signcolumn', 'auto:9', {}) + ns = api.nvim_create_namespace 'test' + api.nvim_set_option_value('signcolumn', 'auto:9', {}) end) local example_test3 = [[ @@ -4566,7 +4566,7 @@ l5 insert(example_test3) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S'}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S'}) screen:expect{grid=[[ {1: }^l1 | @@ -4584,7 +4584,7 @@ l5 insert(example_test3) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row=1}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row=1}) screen:expect{grid=[[ {1: }^l1 | @@ -4602,7 +4602,7 @@ l5 insert(example_test3) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 1, 0, {sign_text='S', hl_group='Todo', end_col=1}) + api.nvim_buf_set_extmark(0, ns, 1, 0, {sign_text='S', hl_group='Todo', end_col=1}) screen:expect{grid=[[ {1: }^l1 | S {3:l}2 | @@ -4614,14 +4614,14 @@ l5 | ]]} - meths.nvim_buf_clear_namespace(0, ns, 0, -1) + api.nvim_buf_clear_namespace(0, ns, 0, -1) end) it('can add multiple signs (single extmark)', function() insert(example_test3) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row = 2}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row = 2}) screen:expect{grid=[[ {1: }^l1 | @@ -4639,8 +4639,8 @@ l5 insert(example_test3) feed'gg' - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S1'}) - meths.nvim_buf_set_extmark(0, ns, 3, -1, {sign_text='S2', end_row = 4}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S1'}) + api.nvim_buf_set_extmark(0, ns, 3, -1, {sign_text='S2', end_row = 4}) screen:expect{grid=[[ {1: }^l1 | @@ -4658,8 +4658,8 @@ l5 insert(example_test3) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 3, -1, {sign_text='S1'}) - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row = 3}) + api.nvim_buf_set_extmark(0, ns, 3, -1, {sign_text='S1'}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row = 3}) screen:expect{grid=[[ {1: }^l1 | S2{1: }l2 | @@ -4677,8 +4677,8 @@ l5 insert(example_test3) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S1', end_row=2}) - meths.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S2', end_row=3}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S1', end_row=2}) + api.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S2', end_row=3}) screen:expect{grid=[[ {1: }^l1 | @@ -4696,8 +4696,8 @@ l5 insert(example_test3) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=0}) - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row=1}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=0}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row=1}) screen:expect{grid=[[ S1^l1 | @@ -4718,10 +4718,10 @@ l5 helpers.command('sign define Oldsign text=x') helpers.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]]) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1'}) - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2'}) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4'}) - meths.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1'}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2'}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4'}) + api.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) screen:expect{grid=[[ S1S4^l1 | @@ -4742,11 +4742,11 @@ l5 helpers.command('sign define Oldsign text=x') helpers.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]]) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1'}) - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2'}) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S3', end_row = 4}) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4'}) - meths.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1'}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2'}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S3', end_row = 4}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4'}) + api.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) screen:expect{grid=[[ S1S3S4^l1 | @@ -4766,7 +4766,7 @@ l5 feed 'gg' feed '2<C-e>' - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='X', end_row=3}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='X', end_row=3}) screen:expect{grid=[[ X {1: }^l3 | @@ -4783,18 +4783,18 @@ l5 command 'normal 10oa b c d e f g h' for i = 1, 10 do - meths.nvim_buf_set_extmark(0, ns, i, 0, { end_col = 1, hl_group='Todo' }) - meths.nvim_buf_set_extmark(0, ns, i, 2, { end_col = 3, hl_group='Todo' }) - meths.nvim_buf_set_extmark(0, ns, i, 4, { end_col = 5, hl_group='Todo' }) - meths.nvim_buf_set_extmark(0, ns, i, 6, { end_col = 7, hl_group='Todo' }) - meths.nvim_buf_set_extmark(0, ns, i, 8, { end_col = 9, hl_group='Todo' }) - meths.nvim_buf_set_extmark(0, ns, i, 10, { end_col = 11, hl_group='Todo' }) - meths.nvim_buf_set_extmark(0, ns, i, 12, { end_col = 13, hl_group='Todo' }) - meths.nvim_buf_set_extmark(0, ns, i, 14, { end_col = 15, hl_group='Todo' }) - meths.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='W' }) - meths.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='X' }) - meths.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='Y' }) - meths.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='Z' }) + api.nvim_buf_set_extmark(0, ns, i, 0, { end_col = 1, hl_group='Todo' }) + api.nvim_buf_set_extmark(0, ns, i, 2, { end_col = 3, hl_group='Todo' }) + api.nvim_buf_set_extmark(0, ns, i, 4, { end_col = 5, hl_group='Todo' }) + api.nvim_buf_set_extmark(0, ns, i, 6, { end_col = 7, hl_group='Todo' }) + api.nvim_buf_set_extmark(0, ns, i, 8, { end_col = 9, hl_group='Todo' }) + api.nvim_buf_set_extmark(0, ns, i, 10, { end_col = 11, hl_group='Todo' }) + api.nvim_buf_set_extmark(0, ns, i, 12, { end_col = 13, hl_group='Todo' }) + api.nvim_buf_set_extmark(0, ns, i, 14, { end_col = 15, hl_group='Todo' }) + api.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='W' }) + api.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='X' }) + api.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='Y' }) + api.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='Z' }) end screen:expect{grid=[[ @@ -4812,10 +4812,10 @@ l5 command('sign define Oldsign text=O3') command([[exe 'sign place 42 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]]) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4', priority=100}) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S2', priority=5}) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200}) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4', priority=100}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S2', priority=5}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1}) screen:expect{grid=[[ S1S2O3S4S5^l1 | @@ -4824,7 +4824,7 @@ l5 ]]} -- Check truncation works too - meths.nvim_set_option_value('signcolumn', 'auto', {}) + api.nvim_set_option_value('signcolumn', 'auto', {}) screen:expect{grid=[[ S5^l1 | @@ -4853,10 +4853,10 @@ l5 | ]]} - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1}) screen:expect_unchanged() - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200}) screen:expect{grid=[[ O3O3O3O3O3O3O3O3S5^ | {2:~ }| @@ -4868,10 +4868,10 @@ l5 it('does not set signcolumn for signs without text', function() screen:try_resize(20, 3) - meths.nvim_set_option_value('signcolumn', 'auto', {}) + api.nvim_set_option_value('signcolumn', 'auto', {}) insert(example_test3) feed 'gg' - meths.nvim_buf_set_extmark(0, ns, 0, -1, {number_hl_group='Error'}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {number_hl_group='Error'}) screen:expect{grid=[[ ^l1 | l2 | @@ -4882,9 +4882,9 @@ l5 it('correct width when removing multiple signs from sentinel line', function() screen:try_resize(20, 4) insert(example_test3) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=3}) - meths.nvim_buf_set_extmark(0, ns, 1, -1, {invalidate = true, sign_text='S2'}) - meths.nvim_buf_set_extmark(0, ns, 1, -1, {invalidate = true, sign_text='S3'}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=3}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {invalidate = true, sign_text='S2'}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {invalidate = true, sign_text='S3'}) feed('2Gdd') screen:expect{grid=[[ @@ -4898,8 +4898,8 @@ l5 it('correct width with multiple overlapping signs', function() screen:try_resize(20, 4) insert(example_test3) - meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=2}) - meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row=2}) + api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=2}) + api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row=2}) feed('gg') screen:expect{grid=[[ @@ -4934,9 +4934,9 @@ describe('decorations: virt_text', function() command 'normal 4ohello' command 'normal aVIRTUAL' - local ns = meths.nvim_create_namespace('test') + local ns = api.nvim_create_namespace('test') - meths.nvim_buf_set_extmark(0, ns, 2, 0, { + api.nvim_buf_set_extmark(0, ns, 2, 0, { virt_text = {{"hello", "String"}}, virt_text_win_col = 20, }) @@ -4976,9 +4976,9 @@ describe('decorations: virt_text', function() | ]]} - local ns = meths.nvim_create_namespace('ns') + local ns = api.nvim_create_namespace('ns') for row = 1, 5 do - meths.nvim_buf_set_extmark(0, ns, row, 0, { id = 1, virt_text = {{'world', 'Normal'}} }) + api.nvim_buf_set_extmark(0, ns, row, 0, { id = 1, virt_text = {{'world', 'Normal'}} }) end screen:expect{grid=[[ diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index 0c9ca6199b..cbb6ee466b 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -9,7 +9,7 @@ local write_file = helpers.write_file local dedent = helpers.dedent local exec = helpers.exec local eq = helpers.eq -local meths = helpers.meths +local api = helpers.api before_each(clear) @@ -1053,7 +1053,7 @@ AAAB]] write_file(fname, 'aaa\nbbb\nccc\n\nxx', false) write_file(fname_2, 'aaa\nbbb\nccc\n\nyy', false) reread() - local buf = meths.nvim_get_current_buf() + local buf = api.nvim_get_current_buf() command('botright new') screen:expect { grid = [[ @@ -1071,7 +1071,7 @@ AAAB]] ]], } - meths.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) + api.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) screen:expect { grid = [[ {1: }aaa │{1: }aaa | @@ -1093,7 +1093,7 @@ AAAB]] write_file(fname, 'aaa\nbbb\nccc\n\nxx', false) write_file(fname_2, 'aaa\nbbb\nccc\n\nyy', false) reread() - local buf = meths.nvim_get_current_buf() + local buf = api.nvim_get_current_buf() command('botright split | diffoff') screen:expect { grid = [[ @@ -1115,7 +1115,7 @@ AAAB]] ]], } - meths.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) + api.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) screen:expect { grid = [[ {1: }aaa │{1: }aaa | @@ -1372,14 +1372,14 @@ it("diff mode doesn't restore invalid 'foldcolumn' value #21647", function() [0] = { foreground = Screen.colors.Blue, bold = true }, }) screen:attach() - eq('0', meths.nvim_get_option_value('foldcolumn', {})) + eq('0', api.nvim_get_option_value('foldcolumn', {})) command('diffsplit | bd') screen:expect([[ ^ | {0:~ }|*4 | ]]) - eq('0', meths.nvim_get_option_value('foldcolumn', {})) + eq('0', api.nvim_get_option_value('foldcolumn', {})) end) -- oldtest: Test_diff_binary() diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua index a9506f2b38..9e08f7748e 100644 --- a/test/functional/ui/embed_spec.lua +++ b/test/functional/ui/embed_spec.lua @@ -8,7 +8,7 @@ local eq = helpers.eq local neq = helpers.neq local clear = helpers.clear local ok = helpers.ok -local funcs = helpers.funcs +local fn = helpers.fn local nvim_prog = helpers.nvim_prog local retry = helpers.retry @@ -178,7 +178,7 @@ describe('--embed --listen UI', function() helpers.skip(helpers.is_os('win')) clear() local child_server = assert(helpers.new_pipename()) - funcs.jobstart({ + fn.jobstart({ nvim_prog, '--embed', '--listen', diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 944e40876f..d08e346fc2 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -11,14 +11,14 @@ local expect = helpers.expect local exec = helpers.exec local exec_lua = helpers.exec_lua local insert = helpers.insert -local meths = helpers.meths -local funcs = helpers.funcs +local api = helpers.api +local fn = helpers.fn local run = helpers.run local pcall_err = helpers.pcall_err local tbl_contains = vim.tbl_contains -local curbuf = helpers.meths.nvim_get_current_buf -local curwin = helpers.meths.nvim_get_current_win -local curtab = helpers.meths.nvim_get_current_tabpage +local curbuf = helpers.api.nvim_get_current_buf +local curwin = helpers.api.nvim_get_current_win +local curtab = helpers.api.nvim_get_current_tabpage local NIL = vim.NIL describe('float window', function() @@ -31,36 +31,36 @@ describe('float window', function() -- Create three windows and test that ":wincmd <direction>" changes to the -- first window, if the previous window is invalid. command('split') - meths.nvim_open_win(0, true, {width=10, height=10, relative='editor', row=0, col=0}) - eq(1002, funcs.win_getid()) - eq('editor', meths.nvim_win_get_config(1002).relative) + api.nvim_open_win(0, true, {width=10, height=10, relative='editor', row=0, col=0}) + eq(1002, fn.win_getid()) + eq('editor', api.nvim_win_get_config(1002).relative) command([[ call nvim_win_close(1001, v:false) wincmd j ]]) - eq(1000, funcs.win_getid()) + eq(1000, fn.win_getid()) end) it('win_execute() should work' , function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'the floatwin', 'abc', 'def'}) - local win = meths.nvim_open_win(buf, false, {relative='win', width=16, height=1, row=0, col=10}) - local line = funcs.win_execute(win, 'echo getline(1)') + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'the floatwin', 'abc', 'def'}) + local win = api.nvim_open_win(buf, false, {relative='win', width=16, height=1, row=0, col=10}) + local line = fn.win_execute(win, 'echo getline(1)') eq('\nthe floatwin', line) - eq('\n1', funcs.win_execute(win, 'echo line(".",'..win.id..')')) - eq('\n3', funcs.win_execute(win, 'echo line("$",'..win.id..')')) - eq('\n0', funcs.win_execute(win, 'echo line("$", 123456)')) - funcs.win_execute(win, 'bwipe!') + eq('\n1', fn.win_execute(win, 'echo line(".",'..win.id..')')) + eq('\n3', fn.win_execute(win, 'echo line("$",'..win.id..')')) + eq('\n0', fn.win_execute(win, 'echo line("$", 123456)')) + fn.win_execute(win, 'bwipe!') end) it("win_execute() call commands that are not allowed when 'hidden' is not set" , function() command('set nohidden') - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'the floatwin'}) - local win = meths.nvim_open_win(buf, true, {relative='win', width=16, height=1, row=0, col=10}) - eq('Vim(close):E37: No write since last change (add ! to override)', pcall_err(funcs.win_execute, win, 'close')) - eq('Vim(bdelete):E89: No write since last change for buffer 2 (add ! to override)', pcall_err(funcs.win_execute, win, 'bdelete')) - funcs.win_execute(win, 'bwipe!') + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'the floatwin'}) + local win = api.nvim_open_win(buf, true, {relative='win', width=16, height=1, row=0, col=10}) + eq('Vim(close):E37: No write since last change (add ! to override)', pcall_err(fn.win_execute, win, 'close')) + eq('Vim(bdelete):E89: No write since last change for buffer 2 (add ! to override)', pcall_err(fn.win_execute, win, 'bdelete')) + fn.win_execute(win, 'bwipe!') end) it('closed immediately by autocmd #11383', function() @@ -193,7 +193,7 @@ describe('float window', function() end) it('opened with correct position relative to the mouse', function() - meths.nvim_input_mouse('left', 'press', '', 0, 10, 10) + api.nvim_input_mouse('left', 'press', '', 0, 10, 10) local pos = exec_lua([[ local bufnr = vim.api.nvim_create_buf(false, true) @@ -480,67 +480,67 @@ describe('float window', function() it('no crash with bufpos and non-existent window', function() command('new') - local closed_win = meths.nvim_get_current_win().id + local closed_win = api.nvim_get_current_win().id command('close') - local buf = meths.nvim_create_buf(false,false) - meths.nvim_open_win(buf, true, {relative='win', win=closed_win, width=1, height=1, bufpos={0,0}}) + local buf = api.nvim_create_buf(false,false) + api.nvim_open_win(buf, true, {relative='win', win=closed_win, width=1, height=1, bufpos={0,0}}) assert_alive() end) 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.nvim_open_win(0, true, float_opts) - meths.nvim_set_option_value('fillchars', NIL, {win=float_win.id}) + local float_win = api.nvim_open_win(0, true, float_opts) + api.nvim_set_option_value('fillchars', NIL, {win=float_win.id}) float_opts.style = 'minimal' - meths.nvim_win_set_config(float_win, float_opts) + api.nvim_win_set_config(float_win, float_opts) assert_alive() end) it("should re-apply 'style' when present", function() local float_opts = {style = 'minimal', relative = 'editor', row = 1, col = 1, width = 1, height = 1} - local float_win = meths.nvim_open_win(0, true, float_opts) - meths.nvim_set_option_value('number', true, { win = float_win }) + local float_win = api.nvim_open_win(0, true, float_opts) + api.nvim_set_option_value('number', true, { win = float_win }) float_opts.row = 2 - meths.nvim_win_set_config(float_win, float_opts) - eq(false, meths.nvim_get_option_value('number', { win = float_win })) + api.nvim_win_set_config(float_win, float_opts) + eq(false, api.nvim_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.nvim_open_win(0, true, float_opts) - meths.nvim_set_option_value('number', true, { win = float_win }) + local float_win = api.nvim_open_win(0, true, float_opts) + api.nvim_set_option_value('number', true, { win = float_win }) float_opts.row = 2 float_opts.style = nil - meths.nvim_win_set_config(float_win, float_opts) - eq(true, meths.nvim_get_option_value('number', { win = float_win })) + api.nvim_win_set_config(float_win, float_opts) + eq(true, api.nvim_get_option_value('number', { win = float_win })) end) it("'scroll' is computed correctly when opening float with splitkeep=screen #20684", function() - meths.nvim_set_option_value('splitkeep', 'screen', {}) + api.nvim_set_option_value('splitkeep', 'screen', {}) local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10} - local float_win = meths.nvim_open_win(0, true, float_opts) - eq(5, meths.nvim_get_option_value('scroll', {win=float_win.id})) + local float_win = api.nvim_open_win(0, true, float_opts) + eq(5, api.nvim_get_option_value('scroll', {win=float_win.id})) end) it(':unhide works when there are floating windows', function() local float_opts = {relative = 'editor', row = 1, col = 1, width = 5, height = 5} local w0 = curwin() - meths.nvim_open_win(0, false, float_opts) - meths.nvim_open_win(0, false, float_opts) - eq(3, #meths.nvim_list_wins()) + api.nvim_open_win(0, false, float_opts) + api.nvim_open_win(0, false, float_opts) + eq(3, #api.nvim_list_wins()) command('unhide') - eq({ w0 }, meths.nvim_list_wins()) + eq({ w0 }, api.nvim_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.nvim_open_win(0, false, float_opts) - meths.nvim_open_win(0, false, float_opts) - eq(3, #meths.nvim_list_wins()) + api.nvim_open_win(0, false, float_opts) + api.nvim_open_win(0, false, float_opts) + eq(3, #api.nvim_list_wins()) command('all') - eq({ w0 }, meths.nvim_list_wins()) + eq({ w0 }, api.nvim_list_wins()) end) describe('with only one tabpage,', function() @@ -553,37 +553,37 @@ describe('float window', function() end) describe('closing the last non-floating window gives E444', function() before_each(function() - meths.nvim_open_win(old_buf, true, float_opts) + api.nvim_open_win(old_buf, true, float_opts) end) it('if called from non-floating window', function() - meths.nvim_set_current_win(old_win) + api.nvim_set_current_win(old_win) eq('Vim:E444: Cannot close last window', - pcall_err(meths.nvim_win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) it('if called from floating window', function() eq('Vim:E444: Cannot close last window', - pcall_err(meths.nvim_win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) end) describe("deleting the last non-floating window's buffer", function() describe('leaves one window with an empty buffer when there is only one buffer', function() local same_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() eq(old_win, curwin().id) expect('') - eq(1, #meths.nvim_list_wins()) + eq(1, #api.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) end) it('if called from floating window', function() - meths.nvim_set_current_win(same_buf_float) + api.nvim_set_current_win(same_buf_float) command('autocmd WinLeave * let g:win_leave = nvim_get_current_win()') command('autocmd WinEnter * let g:win_enter = nvim_get_current_win()') - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, eval('g:win_leave')) eq(old_win, eval('g:win_enter')) end) @@ -591,67 +591,67 @@ describe('float window', function() describe('closes other windows with that buffer when there are other buffers', function() local same_buf_float, other_buf, other_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id - other_buf = meths.nvim_create_buf(true, false).id - other_buf_float = meths.nvim_open_win(other_buf, true, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id + other_buf = api.nvim_create_buf(true, false).id + other_buf_float = api.nvim_open_win(other_buf, true, float_opts).id insert('bar') - meths.nvim_set_current_win(old_win) + api.nvim_set_current_win(old_win) end) after_each(function() eq(other_buf, curbuf().id) expect('bar') - eq(2, #meths.nvim_list_wins()) + eq(2, #api.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from floating window with the same buffer', function() - meths.nvim_set_current_win(same_buf_float) + api.nvim_set_current_win(same_buf_float) command('autocmd WinLeave * let g:win_leave = nvim_get_current_win()') command('autocmd WinEnter * let g:win_enter = nvim_get_current_win()') - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, eval('g:win_leave')) eq(old_win, eval('g:win_enter')) eq(old_win, curwin().id) end) -- TODO: this case is too hard to deal with pending('if called from floating window with another buffer', function() - meths.nvim_set_current_win(other_buf_float) - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_set_current_win(other_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) end) end) describe('creates an empty buffer when there is only one listed buffer', function() local same_buf_float, unlisted_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id - local unlisted_buf = meths.nvim_create_buf(true, false).id - unlisted_buf_float = meths.nvim_open_win(unlisted_buf, true, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id + local unlisted_buf = api.nvim_create_buf(true, false).id + unlisted_buf_float = api.nvim_open_win(unlisted_buf, true, float_opts).id insert('unlisted') command('set nobuflisted') - meths.nvim_set_current_win(old_win) + api.nvim_set_current_win(old_win) end) after_each(function() expect('') - eq(2, #meths.nvim_list_wins()) + eq(2, #api.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from floating window with the same buffer', function() - meths.nvim_set_current_win(same_buf_float) + api.nvim_set_current_win(same_buf_float) command('autocmd WinLeave * let g:win_leave = nvim_get_current_win()') command('autocmd WinEnter * let g:win_enter = nvim_get_current_win()') - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, eval('g:win_leave')) eq(old_win, eval('g:win_enter')) eq(old_win, curwin().id) end) -- TODO: this case is too hard to deal with pending('if called from floating window with an unlisted buffer', function() - meths.nvim_set_current_win(unlisted_buf_float) - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_set_current_win(unlisted_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) end) end) end) @@ -662,20 +662,20 @@ describe('float window', function() command('botright vnew') insert('unlisted') command('set nobuflisted') - meths.nvim_set_current_win(old_win) - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + api.nvim_set_current_win(old_win) + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() expect('') - eq(2, #meths.nvim_list_wins()) + eq(2, #api.nvim_list_wins()) end) it('if called from non-floating window with the deleted buffer', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from floating window with the deleted buffer', function() - meths.nvim_set_current_win(same_buf_float) - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_set_current_win(same_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, curwin().id) end) end) @@ -697,28 +697,28 @@ describe('float window', function() describe('without splits, deleting the last listed buffer creates an empty buffer', function() local same_buf_float before_each(function() - meths.nvim_set_current_win(old_win) - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + api.nvim_set_current_win(old_win) + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() expect('') - eq(2, #meths.nvim_list_wins()) - eq(2, #meths.nvim_list_tabpages()) + eq(2, #api.nvim_list_wins()) + eq(2, #api.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from non-floating window in another tabpage', function() command('tab split') - eq(3, #meths.nvim_list_tabpages()) - meths.nvim_buf_delete(old_buf, {force = true}) + eq(3, #api.nvim_list_tabpages()) + api.nvim_buf_delete(old_buf, {force = true}) end) it('if called from floating window with the same buffer', function() - meths.nvim_set_current_win(same_buf_float) + api.nvim_set_current_win(same_buf_float) command('autocmd WinLeave * let g:win_leave = nvim_get_current_win()') command('autocmd WinEnter * let g:win_enter = nvim_get_current_win()') - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, eval('g:win_leave')) eq(old_win, eval('g:win_enter')) eq(old_win, curwin().id) @@ -728,22 +728,22 @@ describe('float window', function() local same_buf_float before_each(function() command('botright vsplit') - meths.nvim_set_current_buf(unlisted_buf) - meths.nvim_set_current_win(old_win) - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + api.nvim_set_current_buf(unlisted_buf) + api.nvim_set_current_win(old_win) + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() expect('') - eq(3, #meths.nvim_list_wins()) - eq(2, #meths.nvim_list_tabpages()) + eq(3, #api.nvim_list_wins()) + eq(2, #api.nvim_list_tabpages()) end) it('if called from non-floating window with the deleted buffer', function() - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_buf_delete(old_buf, {force = true}) eq(old_win, curwin().id) end) it('if called from floating window with the deleted buffer', function() - meths.nvim_set_current_win(same_buf_float) - meths.nvim_buf_delete(old_buf, {force = true}) + api.nvim_set_current_win(same_buf_float) + api.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, curwin().id) end) end) @@ -763,38 +763,38 @@ describe('float window', function() describe('closes the tabpage when all floating windows are closeable', function() local same_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() eq(old_tabpage, curtab().id) expect('oldtab') - eq(1, #meths.nvim_list_tabpages()) + eq(1, #api.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.nvim_win_close(old_win, false) + api.nvim_win_close(old_win, false) end) it('if called from floating window', function() - meths.nvim_set_current_win(same_buf_float) - meths.nvim_win_close(old_win, false) + api.nvim_set_current_win(same_buf_float) + api.nvim_win_close(old_win, false) end) end) describe('gives E5601 when there are non-closeable floating windows', function() local other_buf_float before_each(function() command('set nohidden') - local other_buf = meths.nvim_create_buf(true, false).id - other_buf_float = meths.nvim_open_win(other_buf, true, float_opts).id + local other_buf = api.nvim_create_buf(true, false).id + other_buf_float = api.nvim_open_win(other_buf, true, float_opts).id insert('foo') - meths.nvim_set_current_win(old_win) + api.nvim_set_current_win(old_win) end) it('if called from non-floating window', function() eq('Vim:E5601: Cannot close window, only floating window would remain', - pcall_err(meths.nvim_win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) it('if called from floating window', function() - meths.nvim_set_current_win(other_buf_float) + api.nvim_set_current_win(other_buf_float) eq('Vim:E5601: Cannot close window, only floating window would remain', - pcall_err(meths.nvim_win_close, old_win, false)) + pcall_err(api.nvim_win_close, old_win, false)) end) end) end) @@ -802,27 +802,27 @@ describe('float window', function() describe('closes the tabpage when all floating windows are closeable', function() local same_buf_float, other_buf, other_buf_float before_each(function() - same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id - other_buf = meths.nvim_create_buf(true, false).id - other_buf_float = meths.nvim_open_win(other_buf, true, float_opts).id - meths.nvim_set_current_win(old_win) + same_buf_float = api.nvim_open_win(old_buf, false, float_opts).id + other_buf = api.nvim_create_buf(true, false).id + other_buf_float = api.nvim_open_win(other_buf, true, float_opts).id + api.nvim_set_current_win(old_win) end) after_each(function() eq(old_tabpage, curtab().id) expect('oldtab') - eq(1, #meths.nvim_list_tabpages()) + eq(1, #api.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.nvim_buf_delete(old_buf, {force = false}) + api.nvim_buf_delete(old_buf, {force = false}) end) it('if called from floating window with the same buffer', function() - meths.nvim_set_current_win(same_buf_float) - meths.nvim_buf_delete(old_buf, {force = false}) + api.nvim_set_current_win(same_buf_float) + api.nvim_buf_delete(old_buf, {force = false}) end) -- TODO: this case is too hard to deal with pending('if called from floating window with another buffer', function() - meths.nvim_set_current_win(other_buf_float) - meths.nvim_buf_delete(old_buf, {force = false}) + api.nvim_set_current_win(other_buf_float) + api.nvim_buf_delete(old_buf, {force = false}) end) end) -- TODO: what to do when there are non-closeable floating windows? @@ -869,8 +869,8 @@ describe('float window', function() end) it('can be created and reconfigured', function() - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) local expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 5, true}, } @@ -901,7 +901,7 @@ describe('float window', function() end - meths.nvim_win_set_config(win, {relative='editor', row=0, col=10}) + api.nvim_win_set_config(win, {relative='editor', row=0, col=10}) expected_pos[4][4] = 0 expected_pos[4][5] = 10 if multigrid then @@ -927,7 +927,7 @@ describe('float window', function() ]]) end - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -950,8 +950,8 @@ describe('float window', function() it('window position fixed', function() command('rightbelow 20vsplit') - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, false, { + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, false, { relative='win', width=15, height=2, row=2, col=10, anchor='NW', fixed=true}) if multigrid then @@ -986,7 +986,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {fixed=false}) + api.nvim_win_set_config(win, {fixed=false}) if multigrid then screen:expect_unchanged() @@ -1010,8 +1010,8 @@ describe('float window', function() -- or something. command("set redrawdebug=compositor") command("set wd=1") - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) local expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 5, true}, } @@ -1042,7 +1042,7 @@ describe('float window', function() end - meths.nvim_win_set_config(win, {relative='editor', row=0, col=10}) + api.nvim_win_set_config(win, {relative='editor', row=0, col=10}) expected_pos[4][4] = 0 expected_pos[4][5] = 10 if multigrid then @@ -1068,7 +1068,7 @@ describe('float window', function() ]]) end - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -1090,16 +1090,16 @@ describe('float window', function() end) it('return their configuration', function() - local buf = meths.nvim_create_buf(false, false) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60}) + local buf = api.nvim_create_buf(false, false) + local win = api.nvim_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, hide=false} - eq(expected, meths.nvim_win_get_config(win)) + eq(expected, api.nvim_win_get_config(win)) - eq({relative='', external=false, focusable=true, hide=false}, meths.nvim_win_get_config(0)) + eq({relative='', external=false, focusable=true, hide=false}, api.nvim_win_get_config(0)) if multigrid then - meths.nvim_win_set_config(win, {external=true, width=10, height=1}) - eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, meths.nvim_win_get_config(win)) + api.nvim_win_set_config(win, {external=true, width=10, height=1}) + eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, api.nvim_win_get_config(win)) end end) @@ -1107,7 +1107,7 @@ describe('float window', function() command('set number') command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ix<cr>y<cr><esc>gg') - local win = meths.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10}) + local win = api.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1138,8 +1138,8 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false, true) - meths.nvim_win_set_buf(win, buf) + local buf = api.nvim_create_buf(false, true) + api.nvim_win_set_buf(win, buf) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1175,7 +1175,7 @@ describe('float window', function() command('set foldcolumn=1') command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ix<cr>y<cr><esc>gg') - local win = meths.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + local win = api.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1239,8 +1239,8 @@ describe('float window', function() end command('sign unplace 1 buffer=1') - local buf = meths.nvim_create_buf(false, true) - meths.nvim_win_set_buf(win, buf) + local buf = api.nvim_create_buf(false, true) + api.nvim_win_set_buf(win, buf) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1275,7 +1275,7 @@ describe('float window', function() command('set foldcolumn=1') command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ix<cr>y<cr><esc>gg') - local win = meths.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + local win = api.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1339,8 +1339,8 @@ describe('float window', function() end command('sign unplace 1 buffer=1') - local buf = meths.nvim_create_buf(false, true) - meths.nvim_win_set_buf(win, buf) + local buf = api.nvim_create_buf(false, true) + api.nvim_win_set_buf(win, buf) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1376,7 +1376,7 @@ describe('float window', function() command('set statuscolumn=%l%s%C') command('hi NormalFloat guibg=#333333 guifg=NONE') feed('ix<cr>y<cr><esc>gg') - meths.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + api.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1407,10 +1407,10 @@ describe('float window', function() end) it('can have border', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=9, height=2, row=2, col=5, border="double"}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=9, height=2, row=2, col=5, border="double"}) if multigrid then screen:expect{grid=[[ @@ -1445,7 +1445,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border="single"}) + api.nvim_win_set_config(win, {border="single"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1479,7 +1479,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border="rounded"}) + api.nvim_win_set_config(win, {border="rounded"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1513,7 +1513,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border="solid"}) + api.nvim_win_set_config(win, {border="solid"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1548,7 +1548,7 @@ describe('float window', function() end -- support: ascii char, UTF-8 char, composed char, highlight per char - meths.nvim_win_set_config(win, {border={"x", {"å", "ErrorMsg"}, {"\\"}, {"n̈̊", "Search"}}}) + api.nvim_win_set_config(win, {border={"x", {"å", "ErrorMsg"}, {"\\"}, {"n̈̊", "Search"}}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1582,7 +1582,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border="none"}) + api.nvim_win_set_config(win, {border="none"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1613,7 +1613,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border={"", "", "", ">", "", "", "", "<"}}) + api.nvim_win_set_config(win, {border={"", "", "", ">", "", "", "", "<"}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1644,7 +1644,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {border={"", "_", "", "", "", "-", "", ""}}) + api.nvim_win_set_config(win, {border={"", "_", "", "", "", "-", "", ""}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1686,7 +1686,7 @@ describe('float window', function() of border shadow ]] - meths.nvim_win_set_config(win, {border="shadow"}) + api.nvim_win_set_config(win, {border="shadow"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1725,13 +1725,13 @@ describe('float window', function() end) it('validates title title_pos', function() - local buf = meths.nvim_create_buf(false,false) + local buf = api.nvim_create_buf(false,false) eq("title requires border to be set", - pcall_err(meths.nvim_open_win,buf, false, { + pcall_err(api.nvim_open_win,buf, false, { relative='editor', width=9, height=2, row=2, col=5, title='Title', })) eq("title_pos requires title to be set", - pcall_err(meths.nvim_open_win,buf, false, { + pcall_err(api.nvim_open_win,buf, false, { relative='editor', width=9, height=2, row=2, col=5, border='single', title_pos='left', })) @@ -1759,13 +1759,13 @@ describe('float window', function() end) it('validates footer footer_pos', function() - local buf = meths.nvim_create_buf(false,false) + local buf = api.nvim_create_buf(false,false) eq("footer requires border to be set", - pcall_err(meths.nvim_open_win,buf, false, { + pcall_err(api.nvim_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.nvim_open_win,buf, false, { + pcall_err(api.nvim_open_win,buf, false, { relative='editor', width=9, height=2, row=2, col=5, border='single', footer_pos='left', })) @@ -1793,10 +1793,10 @@ describe('float window', function() end) it('center aligned title longer than window width #25746', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, { + local win = api.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", title = "abcdefghijklmnopqrstuvwxyz",title_pos = "center", }) @@ -1834,15 +1834,15 @@ describe('float window', function() ]]} end - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) assert_alive() end) it('border with title', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, { + local win = api.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", title = "Left",title_pos = "left", }) @@ -1880,7 +1880,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= "Center",title_pos="center"}) + api.nvim_win_set_config(win, {title= "Center",title_pos="center"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1914,7 +1914,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= "Right",title_pos="right"}) + api.nvim_win_set_config(win, {title= "Right",title_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1948,7 +1948,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= { {"🦄"},{"BB"}},title_pos="right"}) + api.nvim_win_set_config(win, {title= { {"🦄"},{"BB"}},title_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1984,10 +1984,10 @@ describe('float window', function() end) it('border with footer', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, { + local win = api.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", footer = "Left",footer_pos = "left", }) @@ -2025,7 +2025,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {footer= "Center",footer_pos="center"}) + api.nvim_win_set_config(win, {footer= "Center",footer_pos="center"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2059,7 +2059,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {footer= "Right",footer_pos="right"}) + api.nvim_win_set_config(win, {footer= "Right",footer_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2093,7 +2093,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {footer= { {"🦄"},{"BB"}},footer_pos="right"}) + api.nvim_win_set_config(win, {footer= { {"🦄"},{"BB"}},footer_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2129,10 +2129,10 @@ describe('float window', function() end) it('border with title and footer', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, { + local win = api.nvim_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", }) @@ -2170,7 +2170,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= "Center",title_pos="center",footer= "Center",footer_pos="center"}) + api.nvim_win_set_config(win, {title= "Center",title_pos="center",footer= "Center",footer_pos="center"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2204,7 +2204,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {title= "Right",title_pos="right",footer= "Left",footer_pos="left"}) + api.nvim_win_set_config(win, {title= "Right",title_pos="right",footer= "Left",footer_pos="left"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2240,7 +2240,7 @@ describe('float window', function() command('hi B0 guibg=Red guifg=Black') command('hi B1 guifg=White') - meths.nvim_win_set_config(win, { + api.nvim_win_set_config(win, { title = {{"🦄"}, {"BB", {"B0", "B1"}}}, title_pos = "right", footer= {{"🦄"}, {"BB", {"B0", "B1"}}}, footer_pos = "right", }) @@ -2279,8 +2279,8 @@ describe('float window', function() end) it('terminates border on edge of viewport when window extends past viewport', function() - local buf = meths.nvim_create_buf(false, false) - meths.nvim_open_win(buf, false, {relative='editor', width=40, height=7, row=0, col=0, border="single", zindex=201}) + local buf = api.nvim_create_buf(false, false) + api.nvim_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 @@ -2314,10 +2314,10 @@ describe('float window', function() it('with border show popupmenu', function() screen:try_resize(40,10) - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', 'abb acc ', ''}) - meths.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5, border="double"}) + api.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5, border="double"}) feed 'G' if multigrid then @@ -2483,10 +2483,10 @@ describe('float window', function() it('show ruler of current floating window', function() command 'set ruler' - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', 'abb acc '}) - meths.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5}) + api.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5}) feed 'gg' if multigrid then @@ -2553,7 +2553,7 @@ describe('float window', function() it("correct ruler position in current float with 'rulerformat' set", function() command 'set ruler rulerformat=fish:<><' - meths.nvim_open_win(0, true, {relative='editor', width=9, height=3, row=0, col=5}) + api.nvim_open_win(0, true, {relative='editor', width=9, height=3, row=0, col=5}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2586,11 +2586,11 @@ describe('float window', function() it('does not show ruler of not-last current float during ins-completion', function() screen:try_resize(50,9) command 'set ruler showmode' - meths.nvim_open_win(0, false, {relative='editor', width=3, height=3, row=0, col=0}) - meths.nvim_open_win(0, false, {relative='editor', width=3, height=3, row=0, col=5}) + api.nvim_open_win(0, false, {relative='editor', width=3, height=3, row=0, col=0}) + api.nvim_open_win(0, false, {relative='editor', width=3, height=3, row=0, col=5}) feed '<c-w>w' - neq('', meths.nvim_win_get_config(0).relative) - neq(funcs.winnr '$', funcs.winnr()) + neq('', api.nvim_win_get_config(0).relative) + neq(fn.winnr '$', fn.winnr()) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2660,9 +2660,9 @@ describe('float window', function() it('can have minimum size', function() insert("the background text") - local buf = meths.nvim_create_buf(false, true) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'x'}) - local win = meths.nvim_open_win(buf, false, {relative='win', width=1, height=1, row=0, col=4, focusable=false}) + local buf = api.nvim_create_buf(false, true) + api.nvim_buf_set_lines(buf, 0, -1, true, {'x'}) + local win = api.nvim_open_win(buf, false, {relative='win', width=1, height=1, row=0, col=4, focusable=false}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2686,7 +2686,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='win', row=0, col=15}) + api.nvim_win_set_config(win, {relative='win', row=0, col=15}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2710,7 +2710,7 @@ describe('float window', function() ]]) end - meths.nvim_win_close(win,false) + api.nvim_win_close(win,false) if multigrid then screen:expect([[ ## grid 1 @@ -2746,8 +2746,8 @@ describe('float window', function() command('sargument 6') local float_opts = { relative = 'editor', row = 6, col = 0, width = 40, height = 1 } - meths.nvim_win_set_config(w3, float_opts) - meths.nvim_win_set_config(w4, float_opts) + api.nvim_win_set_config(w3, float_opts) + api.nvim_win_set_config(w4, float_opts) command('wincmd =') if multigrid then screen:expect{grid=[[ @@ -2876,36 +2876,36 @@ describe('float window', function() end) it('API has proper error messages', function() - local buf = meths.nvim_create_buf(false,false) + local buf = api.nvim_create_buf(false,false) eq("Invalid key: 'bork'", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,bork=true})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,bork=true})) eq("'win' key is only valid with relative='win'", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0})) eq("Only one of 'relative' and 'external' must be used", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,external=true})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,external=true})) eq("Invalid value of 'relative' key", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0})) eq("Invalid value of 'anchor' key", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,anchor='bottom'})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,anchor='bottom'})) eq("'relative' requires 'row'/'col' or 'bufpos'", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='editor'})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=2,relative='editor'})) eq("'width' key must be a positive Integer", - pcall_err(meths.nvim_open_win,buf, false, {width=-1,height=2,relative='editor', row=0, col=0})) + pcall_err(api.nvim_open_win,buf, false, {width=-1,height=2,relative='editor', row=0, col=0})) eq("'height' key must be a positive Integer", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=-1,relative='editor', row=0, col=0})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=-1,relative='editor', row=0, col=0})) eq("'height' key must be a positive Integer", - pcall_err(meths.nvim_open_win,buf, false, {width=20,height=0,relative='editor', row=0, col=0})) + pcall_err(api.nvim_open_win,buf, false, {width=20,height=0,relative='editor', row=0, col=0})) eq("Must specify 'width'", - pcall_err(meths.nvim_open_win,buf, false, {relative='editor', row=0, col=0})) + pcall_err(api.nvim_open_win,buf, false, {relative='editor', row=0, col=0})) eq("Must specify 'height'", - pcall_err(meths.nvim_open_win,buf, false, {relative='editor', row=0, col=0, width=2})) + pcall_err(api.nvim_open_win,buf, false, {relative='editor', row=0, col=0, width=2})) end) it('can be placed relative window or cursor', function() screen:try_resize(40,9) - meths.nvim_buf_set_lines(0, 0, -1, true, {'just some', 'example text'}) + api.nvim_buf_set_lines(0, 0, -1, true, {'just some', 'example text'}) feed('gge') - local oldwin = meths.nvim_get_current_win() + local oldwin = api.nvim_get_current_win() command('below split') if multigrid then screen:expect([[ @@ -2940,9 +2940,9 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false,false) + local buf = api.nvim_create_buf(false,false) -- no 'win' arg, relative default window - local win = meths.nvim_open_win(buf, false, {relative='win', width=20, height=2, row=0, col=10}) + local win = api.nvim_open_win(buf, false, {relative='win', width=20, height=2, row=0, col=10}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2981,7 +2981,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=1, col=-2}) + api.nvim_win_set_config(win, {relative='cursor', row=1, col=-2}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3020,7 +3020,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=0, col=0, anchor='SW'}) + api.nvim_win_set_config(win, {relative='cursor', row=0, col=0, anchor='SW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3059,7 +3059,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='win', win=oldwin, row=1, col=10, anchor='NW'}) + api.nvim_win_set_config(win, {relative='win', win=oldwin, row=1, col=10, anchor='NW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3098,7 +3098,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='win', win=oldwin, row=3, col=39, anchor='SE'}) + api.nvim_win_set_config(win, {relative='win', win=oldwin, row=3, col=39, anchor='SE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3137,7 +3137,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='win', win=0, row=0, col=50, anchor='NE'}) + api.nvim_win_set_config(win, {relative='win', win=0, row=0, col=50, anchor='NE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3207,7 +3207,7 @@ describe('float window', function() it('always anchor to corner including border', function() screen:try_resize(40,13) - meths.nvim_buf_set_lines(0, 0, -1, true, {'just some example text', 'some more example text'}) + api.nvim_buf_set_lines(0, 0, -1, true, {'just some example text', 'some more example text'}) feed('ggeee') command('below split') if multigrid then @@ -3243,10 +3243,10 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false, false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = api.nvim_create_buf(false, false) + api.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.nvim_open_win(buf, false, {relative='cursor', width=9, height=2, row=1, col=-2, border="double"}) + local win = api.nvim_open_win(buf, false, {relative='cursor', width=9, height=2, row=1, col=-2, border="double"}) if multigrid then screen:expect{grid=[[ @@ -3290,7 +3290,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='NE'}) + api.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='NE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3333,7 +3333,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=1, col=-2, anchor='SE'}) + api.nvim_win_set_config(win, {relative='cursor', row=1, col=-2, anchor='SE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3376,7 +3376,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='SW'}) + api.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='SW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3596,8 +3596,8 @@ describe('float window', function() it('can be placed relative text in a window', function() screen:try_resize(30,5) - local firstwin = meths.nvim_get_current_win().id - meths.nvim_buf_set_lines(0, 0, -1, true, {'just some', 'example text that is wider than the window', '', '', 'more text'}) + local firstwin = api.nvim_get_current_win().id + api.nvim_buf_set_lines(0, 0, -1, true, {'just some', 'example text that is wider than the window', '', '', 'more text'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3620,10 +3620,10 @@ describe('float window', function() ]]} end - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'some info!'}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'some info!'}) - local win = meths.nvim_open_win(buf, false, {relative='win', width=12, height=1, bufpos={1,32}}) + local win = api.nvim_open_win(buf, false, {relative='win', width=12, height=1, bufpos={1,32}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3651,7 +3651,7 @@ describe('float window', function() ]]} end 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.nvim_win_get_config(win)) + external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, api.nvim_win_get_config(win)) feed('<c-e>') if multigrid then @@ -3739,7 +3739,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='SW'}) + api.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='SW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3812,7 +3812,7 @@ describe('float window', function() end command('close') - meths.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='NW', col=-2}) + api.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='NW', col=-2}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3843,7 +3843,7 @@ describe('float window', function() ]]} end - meths.nvim_win_set_config(win, {relative='win', bufpos={1,32}, row=2}) + api.nvim_win_set_config(win, {relative='win', bufpos={1,32}, row=2}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3924,9 +3924,9 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false,true) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'some floaty text'}) - meths.nvim_open_win(buf, false, {relative='editor', width=20, height=1, row=3, col=1}) + local buf = api.nvim_create_buf(false,true) + api.nvim_buf_set_lines(buf, 0, -1, true, {'some floaty text'}) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=1, row=3, col=1}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3959,8 +3959,8 @@ describe('float window', function() local screen2 = Screen.new(40,7) screen2:attach(nil, session2) screen2:set_default_attr_ids(attrs) - local buf = meths.nvim_create_buf(false,false) - meths.nvim_open_win(buf, true, {relative='editor', width=20, height=2, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_open_win(buf, true, {relative='editor', width=20, height=2, row=2, col=5}) local expected_pos = { [2]={{id=1001}, 'NW', 1, 2, 5} } @@ -3986,9 +3986,9 @@ describe('float window', function() it('handles resized screen', function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'such', 'very', 'float'}) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=15, height=4, row=2, col=10}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'such', 'very', 'float'}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=15, height=4, row=2, col=10}) local expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 10, true}, } @@ -4151,7 +4151,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {height=3}) + api.nvim_win_set_config(win, {height=3}) feed('gg') if multigrid then screen:expect{grid=[[ @@ -4436,8 +4436,8 @@ describe('float window', function() command("set inccommand=split") command("set laststatus=2") - local buf = meths.nvim_create_buf(false,false) - meths.nvim_open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0}) + local buf = api.nvim_create_buf(false,false) + api.nvim_open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0}) insert([[ foo @@ -4533,17 +4533,17 @@ describe('float window', function() end) it('does not crash when set cmdheight #9680', function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) command("set cmdheight=2") - eq(1, meths.nvim_eval('1')) + eq(1, api.nvim_eval('1')) end) describe('and completion', function() before_each(function() - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5}).id - meths.nvim_set_option_value('winhl', 'Normal:ErrorMsg', {win=win}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5}).id + api.nvim_set_option_value('winhl', 'Normal:ErrorMsg', {win=win}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4573,7 +4573,7 @@ describe('float window', function() it('with builtin popupmenu', function() feed('ix ') - funcs.complete(3, {'aa', 'word', 'longtext'}) + fn.complete(3, {'aa', 'word', 'longtext'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4636,7 +4636,7 @@ describe('float window', function() end feed('<c-w>wi') - funcs.complete(1, {'xx', 'yy', 'zz'}) + fn.complete(1, {'xx', 'yy', 'zz'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4736,7 +4736,7 @@ describe('float window', function() it('with ext_popupmenu', function() screen:set_option('ext_popupmenu', true) feed('ix ') - funcs.complete(3, {'aa', 'word', 'longtext'}) + fn.complete(3, {'aa', 'word', 'longtext'}) local items = {{"aa", "", "", ""}, {"word", "", "", ""}, {"longtext", "", "", ""}} if multigrid then screen:expect{grid=[[ @@ -4796,7 +4796,7 @@ describe('float window', function() end feed('<c-w>wi') - funcs.complete(1, {'xx', 'yy', 'zz'}) + fn.complete(1, {'xx', 'yy', 'zz'}) items = {{"xx", "", "", ""}, {"yy", "", "", ""}, {"zz", "", "", ""}} if multigrid then screen:expect{grid=[[ @@ -4862,7 +4862,7 @@ describe('float window', function() before_each(function() command('hi NormalFloat guibg=#333333 guifg=NONE') feed('i') - funcs.complete(1, {'aa', 'word', 'longtext'}) + fn.complete(1, {'aa', 'word', 'longtext'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4891,9 +4891,9 @@ describe('float window', function() ]]) end - local buf = meths.nvim_create_buf(false,true) - meths.nvim_buf_set_lines(buf,0,-1,true,{"some info", "about item"}) - win = meths.nvim_open_win(buf, false, {relative='cursor', width=12, height=2, row=1, col=10}) + local buf = api.nvim_create_buf(false,true) + api.nvim_buf_set_lines(buf,0,-1,true,{"some info", "about item"}) + win = api.nvim_open_win(buf, false, {relative='cursor', width=12, height=2, row=1, col=10}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4955,7 +4955,7 @@ describe('float window', function() ]]) end - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -4977,7 +4977,7 @@ describe('float window', function() end) it('and close float first', function() - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -5029,10 +5029,10 @@ describe('float window', function() end) it("can use Normal as background", function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf,0,-1,true,{"here", "float"}) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.nvim_set_option_value('winhl', 'Normal:Normal', {win=win}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf,0,-1,true,{"here", "float"}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + api.nvim_set_option_value('winhl', 'Normal:Normal', {win=win}) if multigrid then screen:expect{grid=[[ @@ -5072,10 +5072,10 @@ describe('float window', function() -- the default, but be explicit: command("set laststatus=1") command("set hidden") - meths.nvim_buf_set_lines(0,0,-1,true,{"x"}) - local buf = meths.nvim_create_buf(false,false) - win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.nvim_buf_set_lines(buf,0,-1,true,{"y"}) + api.nvim_buf_set_lines(0,0,-1,true,{"x"}) + local buf = api.nvim_create_buf(false,false) + win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + api.nvim_buf_set_lines(buf,0,-1,true,{"y"}) expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 5, true} } @@ -5160,7 +5160,7 @@ describe('float window', function() end) it("w with focusable=false", function() - meths.nvim_win_set_config(win, {focusable=false}) + api.nvim_win_set_config(win, {focusable=false}) expected_pos[4][6] = false feed("<c-w>wi") -- i to provoke redraw if multigrid then @@ -5271,7 +5271,7 @@ describe('float window', function() it("focus by mouse", function() if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 0, 0) + api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -5286,7 +5286,7 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos} else - meths.nvim_input_mouse('left', 'press', '', 0, 2, 5) + api.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect([[ x | {0:~ }| @@ -5298,7 +5298,7 @@ describe('float window', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 0, 0) + api.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -5313,7 +5313,7 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos} else - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ ^x | {0:~ }| @@ -5326,11 +5326,11 @@ describe('float window', function() end) it("focus by mouse (focusable=false)", function() - meths.nvim_win_set_config(win, {focusable=false}) - meths.nvim_buf_set_lines(0, -1, -1, true, {"a"}) + api.nvim_win_set_config(win, {focusable=false}) + api.nvim_buf_set_lines(0, -1, -1, true, {"a"}) expected_pos[4][6] = false if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 0, 0) + api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -5346,7 +5346,7 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos} else - meths.nvim_input_mouse('left', 'press', '', 0, 2, 5) + api.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect([[ x | ^a | @@ -5358,7 +5358,7 @@ describe('float window', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 0, 0) + api.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -5374,7 +5374,7 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos, unchanged=true} else - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ ^x | a | @@ -6156,7 +6156,7 @@ describe('float window', function() -- enter first float feed('<c-w><c-w>') -- enter second float - meths.nvim_open_win(0, true, {relative='editor', width=20, height=2, row=4, col=8}) + api.nvim_open_win(0, true, {relative='editor', width=20, height=2, row=4, col=8}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -6476,7 +6476,7 @@ describe('float window', function() end if multigrid then - meths.nvim_win_set_config(0, {external=true, width=30, height=2}) + api.nvim_win_set_config(0, {external=true, width=30, height=2}) expected_pos = {[4]={external=true}} screen:expect{grid=[[ ## grid 1 @@ -6494,7 +6494,7 @@ describe('float window', function() ]], float_pos=expected_pos} else eq("UI doesn't support external windows", - pcall_err(meths.nvim_win_set_config, 0, {external=true, width=30, height=2})) + pcall_err(api.nvim_win_set_config, 0, {external=true, width=30, height=2})) return end @@ -6520,7 +6520,7 @@ describe('float window', function() end) it('J (float with border)', function() - meths.nvim_win_set_config(win, {relative='editor', width=20, height=2, row=2, col=5, border='single'}) + api.nvim_win_set_config(win, {relative='editor', width=20, height=2, row=2, col=5, border='single'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -6625,7 +6625,7 @@ describe('float window', function() for i = 1,5 do feed(i.."<c-w>w") feed_command("enew") - meths.nvim_buf_set_lines(0, 0,-1,true,{tostring(i)}) + api.nvim_buf_set_lines(0, 0,-1,true,{tostring(i)}) end if multigrid then @@ -6681,7 +6681,7 @@ describe('float window', function() for i = 1,5 do feed(i.."<c-w>w") feed('<c-w>'..k) - local nr = funcs.winnr() + local nr = fn.winnr() eq(v[i],nr, "when using <c-w>"..k.." from window "..i) end end @@ -6692,7 +6692,7 @@ describe('float window', function() if j ~= i then feed(j.."<c-w>w") feed('<c-w>p') - local nr = funcs.winnr() + local nr = fn.winnr() eq(i,nr, "when using <c-w>p to window "..i.." from window "..j) end end @@ -6792,7 +6792,7 @@ describe('float window', function() it(":tabnew and :tabnext (external)", function() if multigrid then -- also test external window wider than main screen - meths.nvim_win_set_config(win, {external=true, width=65, height=4}) + api.nvim_win_set_config(win, {external=true, width=65, height=4}) expected_pos = {[4]={external=true}} feed(":tabnew<cr>") screen:expect{grid=[[ @@ -6814,7 +6814,7 @@ describe('float window', function() ]], float_pos=expected_pos} else eq("UI doesn't support external windows", - pcall_err(meths.nvim_win_set_config, 0, {external=true, width=65, height=4})) + pcall_err(api.nvim_win_set_config, 0, {external=true, width=65, height=4})) end feed(":tabnext<cr>") @@ -6862,9 +6862,9 @@ describe('float window', function() end) it("left drag changes visual selection in float window", function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - meths.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=5}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -6886,7 +6886,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.nvim_input_mouse('left', 'press', '', 4, 0, 0) + api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -6907,7 +6907,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.nvim_input_mouse('left', 'drag', '', 4, 1, 2) + api.nvim_input_mouse('left', 'drag', '', 4, 1, 2) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -6938,7 +6938,7 @@ describe('float window', function() | ]]} - meths.nvim_input_mouse('left', 'press', '', 0, 2, 5) + api.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect{grid=[[ | {0:~ }| @@ -6949,7 +6949,7 @@ describe('float window', function() | ]]} - meths.nvim_input_mouse('left', 'drag', '', 0, 3, 7) + api.nvim_input_mouse('left', 'drag', '', 0, 3, 7) screen:expect{grid=[[ | {0:~ }| @@ -6963,9 +6963,9 @@ describe('float window', function() end) it("left drag changes visual selection in float window with border", function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - meths.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -6989,7 +6989,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.nvim_input_mouse('left', 'press', '', 4, 1, 1) + api.nvim_input_mouse('left', 'press', '', 4, 1, 1) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7012,7 +7012,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.nvim_input_mouse('left', 'drag', '', 4, 2, 3) + api.nvim_input_mouse('left', 'drag', '', 4, 2, 3) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7045,7 +7045,7 @@ describe('float window', function() | ]]} - meths.nvim_input_mouse('left', 'press', '', 0, 1, 6) + api.nvim_input_mouse('left', 'press', '', 0, 1, 6) screen:expect{grid=[[ {5:┌────────────────────┐} | {0:~ }{5:│}{1:^foo }{5:│}{0: }| @@ -7056,7 +7056,7 @@ describe('float window', function() | ]]} - meths.nvim_input_mouse('left', 'drag', '', 0, 2, 8) + api.nvim_input_mouse('left', 'drag', '', 0, 2, 8) screen:expect{grid=[[ {5:┌────────────────────┐} | {0:~ }{5:│}{27:foo}{1: }{5:│}{0: }| @@ -7070,10 +7070,10 @@ describe('float window', function() end) it("left drag changes visual selection in float window with winbar", function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - local float_win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=4, row=1, col=5}) - meths.nvim_set_option_value('winbar', 'floaty bar', {win=float_win.id}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) + local float_win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=4, row=1, col=5}) + api.nvim_set_option_value('winbar', 'floaty bar', {win=float_win.id}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7096,7 +7096,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.nvim_input_mouse('left', 'press', '', 4, 1, 0) + api.nvim_input_mouse('left', 'press', '', 4, 1, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7118,7 +7118,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.nvim_input_mouse('left', 'drag', '', 4, 2, 2) + api.nvim_input_mouse('left', 'drag', '', 4, 2, 2) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7150,7 +7150,7 @@ describe('float window', function() | ]]} - meths.nvim_input_mouse('left', 'press', '', 0, 2, 5) + api.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect{grid=[[ | {0:~ }{3:floaty bar }{0: }| @@ -7161,7 +7161,7 @@ describe('float window', function() | ]]} - meths.nvim_input_mouse('left', 'drag', '', 0, 3, 7) + api.nvim_input_mouse('left', 'drag', '', 0, 3, 7) screen:expect{grid=[[ | {0:~ }{3:floaty bar }{0: }| @@ -7175,9 +7175,9 @@ describe('float window', function() end) it('left drag changes visual selection if float window is turned into a split', function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - meths.nvim_open_win(buf, true, {relative='editor', width=20, height=3, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) + api.nvim_open_win(buf, true, {relative='editor', width=20, height=3, row=2, col=5}) command('wincmd L') if multigrid then screen:expect([[ @@ -7197,7 +7197,7 @@ describe('float window', function() {0:~ }|*2 ]]) - meths.nvim_input_mouse('left', 'press', '', 4, 2, 2) + api.nvim_input_mouse('left', 'press', '', 4, 2, 2) screen:expect([[ ## grid 1 [2:-------------------]{5:│}[4:--------------------]|*5 @@ -7215,7 +7215,7 @@ describe('float window', function() {0:~ }|*2 ]]) - meths.nvim_input_mouse('left', 'drag', '', 4, 1, 1) + api.nvim_input_mouse('left', 'drag', '', 4, 1, 1) screen:expect([[ ## grid 1 [2:-------------------]{5:│}[4:--------------------]|*5 @@ -7242,7 +7242,7 @@ describe('float window', function() | ]]) - meths.nvim_input_mouse('left', 'press', '', 0, 2, 22) + api.nvim_input_mouse('left', 'press', '', 0, 2, 22) screen:expect([[ {5:│}foo | {0:~ }{5:│}bar | @@ -7252,7 +7252,7 @@ describe('float window', function() | ]]) - meths.nvim_input_mouse('left', 'drag', '', 0, 1, 21) + api.nvim_input_mouse('left', 'drag', '', 0, 1, 21) screen:expect([[ {5:│}foo | {0:~ }{5:│}b^a{27:r} | @@ -7265,9 +7265,9 @@ describe('float window', function() end) it('left click sets correct curswant in float window with border', function() - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'', '', ''}) - meths.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'', '', ''}) + api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7299,25 +7299,25 @@ describe('float window', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 3, 1) + api.nvim_input_mouse('left', 'press', '', 4, 3, 1) else - meths.nvim_input_mouse('left', 'press', '', 0, 3, 6) + api.nvim_input_mouse('left', 'press', '', 0, 3, 6) end - eq({0, 3, 1, 0, 1}, funcs.getcurpos()) + eq({0, 3, 1, 0, 1}, fn.getcurpos()) if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 3, 2) + api.nvim_input_mouse('left', 'press', '', 4, 3, 2) else - meths.nvim_input_mouse('left', 'press', '', 0, 3, 7) + api.nvim_input_mouse('left', 'press', '', 0, 3, 7) end - eq({0, 3, 1, 0, 2}, funcs.getcurpos()) + eq({0, 3, 1, 0, 2}, fn.getcurpos()) if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 3, 10) + api.nvim_input_mouse('left', 'press', '', 4, 3, 10) else - meths.nvim_input_mouse('left', 'press', '', 0, 3, 15) + api.nvim_input_mouse('left', 'press', '', 0, 3, 15) end - eq({0, 3, 1, 0, 10}, funcs.getcurpos()) + eq({0, 3, 1, 0, 10}, fn.getcurpos()) command('setlocal foldcolumn=1') feed('zfkgg') @@ -7356,7 +7356,7 @@ describe('float window', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 2, 1) + api.nvim_input_mouse('left', 'press', '', 4, 2, 1) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7379,7 +7379,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} else - meths.nvim_input_mouse('left', 'press', '', 0, 2, 6) + api.nvim_input_mouse('left', 'press', '', 0, 2, 6) screen:expect{grid=[[ {5:┌────────────────────┐} | {0:~ }{5:│}{19: }{1:^ }{5:│}{0: }| @@ -7392,25 +7392,25 @@ describe('float window', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 2, 2) + api.nvim_input_mouse('left', 'press', '', 4, 2, 2) else - meths.nvim_input_mouse('left', 'press', '', 0, 2, 7) + api.nvim_input_mouse('left', 'press', '', 0, 2, 7) end - eq({0, 2, 1, 0, 1}, funcs.getcurpos()) + eq({0, 2, 1, 0, 1}, fn.getcurpos()) if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 2, 3) + api.nvim_input_mouse('left', 'press', '', 4, 2, 3) else - meths.nvim_input_mouse('left', 'press', '', 0, 2, 8) + api.nvim_input_mouse('left', 'press', '', 0, 2, 8) end - eq({0, 2, 1, 0, 2}, funcs.getcurpos()) + eq({0, 2, 1, 0, 2}, fn.getcurpos()) if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 2, 11) + api.nvim_input_mouse('left', 'press', '', 4, 2, 11) else - meths.nvim_input_mouse('left', 'press', '', 0, 2, 16) + api.nvim_input_mouse('left', 'press', '', 0, 2, 16) end - eq({0, 2, 1, 0, 10}, funcs.getcurpos()) + eq({0, 2, 1, 0, 10}, fn.getcurpos()) end) it("'winblend' option", function() @@ -7454,9 +7454,9 @@ describe('float window', function() occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.]]) - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {"test", "", "popup text"}) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=15, height=3, row=2, col=5}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {"test", "", "popup text"}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=15, height=3, row=2, col=5}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7492,7 +7492,7 @@ describe('float window', function() ]]) end - meths.nvim_set_option_value("winblend", 30, {win=win.id}) + api.nvim_set_option_value("winblend", 30, {win=win.id}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7529,7 +7529,7 @@ describe('float window', function() end -- Check that 'winblend' works with NormalNC highlight - meths.nvim_set_option_value('winhighlight', 'NormalNC:Visual', {win = win}) + api.nvim_set_option_value('winhighlight', 'NormalNC:Visual', {win = win}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7574,7 +7574,7 @@ describe('float window', function() command('hi clear NormalNC') command('hi SpecialRegion guifg=Red blend=0') - meths.nvim_buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1) + api.nvim_buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7648,7 +7648,7 @@ describe('float window', function() -- Test scrolling by mouse if multigrid then - meths.nvim_input_mouse('wheel', 'down', '', 4, 2, 2) + api.nvim_input_mouse('wheel', 'down', '', 4, 2, 2) screen:expect{grid=[[ ## grid 1 [2:--------------------------------------------------]|*8 @@ -7669,7 +7669,7 @@ describe('float window', function() {12:~ }|*2 ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}} else - meths.nvim_input_mouse('wheel', 'down', '', 0, 4, 7) + api.nvim_input_mouse('wheel', 'down', '', 0, 4, 7) screen:expect([[ Ut enim ad minim veniam, quis nostrud | exercitation ullamco laboris nisi ut aliquip ex | @@ -7684,9 +7684,9 @@ describe('float window', function() end -- Check that 'winblend' applies to border/title/footer - meths.nvim_win_set_config(win, {border='single', title='Title', footer='Footer'}) - meths.nvim_set_option_value('winblend', 100, {win=win.id}) - meths.nvim_set_option_value("cursorline", true, {win=0}) + api.nvim_win_set_config(win, {border='single', title='Title', footer='Footer'}) + api.nvim_set_option_value('winblend', 100, {win=win.id}) + api.nvim_set_option_value("cursorline", true, {win=0}) command('hi clear VertSplit') feed('k0') if multigrid then @@ -7730,9 +7730,9 @@ describe('float window', function() insert([[ # TODO: 测试字典信息的准确性 # FIXME: 测试字典信息的准确性]]) - local buf = meths.nvim_create_buf(false,false) - meths.nvim_buf_set_lines(buf, 0, -1, true, {'口', '口'}) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'}) + local buf = api.nvim_create_buf(false,false) + api.nvim_buf_set_lines(buf, 0, -1, true, {'口', '口'}) + local win = api.nvim_open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7758,7 +7758,7 @@ describe('float window', function() ]]) end - meths.nvim_win_close(win, false) + api.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -7783,9 +7783,9 @@ describe('float window', function() -- The interaction between 'winblend' and doublewidth chars in the background -- does not look very good. But check no chars get incorrectly placed -- at least. Also check invisible EndOfBuffer region blends correctly. - meths.nvim_buf_set_lines(buf, 0, -1, true, {" x x x xx", " x x x x"}) - win = meths.nvim_open_win(buf, false, {relative='editor', width=12, height=3, row=0, col=11, style='minimal'}) - meths.nvim_set_option_value('winblend', 30, {win=win.id}) + api.nvim_buf_set_lines(buf, 0, -1, true, {" x x x xx", " x x x x"}) + win = api.nvim_open_win(buf, false, {relative='editor', width=12, height=3, row=0, col=11, style='minimal'}) + api.nvim_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')}, @@ -7821,7 +7821,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {relative='editor', row=0, col=12}) + api.nvim_win_set_config(win, {relative='editor', row=0, col=12}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7975,9 +7975,9 @@ describe('float window', function() end) it("correctly orders multiple opened floats (current last)", function() - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.nvim_set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + api.nvim_set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id}) if multigrid then screen:expect{grid=[[ @@ -8061,9 +8061,9 @@ describe('float window', function() end) it("correctly orders multiple opened floats (non-current last)", function() - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.nvim_set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + api.nvim_set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id}) if multigrid then screen:expect{grid=[[ @@ -8147,13 +8147,13 @@ describe('float window', function() end) it('can use z-index', function() - local buf = meths.nvim_create_buf(false,false) - local win1 = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=1, col=5, zindex=30}) - meths.nvim_set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win1.id}) - local win2 = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=6, zindex=50}) - meths.nvim_set_option_value("winhl", "Normal:Search,EndOfBuffer:Search", {win=win2.id}) - local win3 = meths.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=3, col=7, zindex=40}) - meths.nvim_set_option_value("winhl", "Normal:Question,EndOfBuffer:Question", {win=win3.id}) + local buf = api.nvim_create_buf(false,false) + local win1 = api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=1, col=5, zindex=30}) + api.nvim_set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win1.id}) + local win2 = api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=6, zindex=50}) + api.nvim_set_option_value("winhl", "Normal:Search,EndOfBuffer:Search", {win=win2.id}) + local win3 = api.nvim_open_win(buf, false, {relative='editor', width=20, height=3, row=3, col=7, zindex=40}) + api.nvim_set_option_value("winhl", "Normal:Question,EndOfBuffer:Question", {win=win3.id}) if multigrid then screen:expect{grid=[[ @@ -8198,9 +8198,9 @@ describe('float window', function() end) it('can use winbar', function() - local buf = meths.nvim_create_buf(false,false) - local win1 = meths.nvim_open_win(buf, false, {relative='editor', width=15, height=3, row=1, col=5}) - meths.nvim_set_option_value('winbar', 'floaty bar', {win=win1.id}) + local buf = api.nvim_create_buf(false,false) + local win1 = api.nvim_open_win(buf, false, {relative='editor', width=15, height=3, row=1, col=5}) + api.nvim_set_option_value('winbar', 'floaty bar', {win=win1.id}) if multigrid then screen:expect{grid=[[ @@ -8234,7 +8234,7 @@ describe('float window', function() end -- resize and add a border - meths.nvim_win_set_config(win1, {relative='editor', width=15, height=4, row=0, col=4, border = 'single'}) + api.nvim_win_set_config(win1, {relative='editor', width=15, height=4, row=0, col=4, border = 'single'}) if multigrid then screen:expect{grid=[[ @@ -8273,8 +8273,8 @@ describe('float window', function() it('it can be resized with messages and cmdheight=0 #20106', function() screen:try_resize(40,9) command 'set cmdheight=0' - local buf = meths.nvim_create_buf(false,true) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=9, col=0, style='minimal', border="single", noautocmd=true}) + local buf = api.nvim_create_buf(false,true) + local win = api.nvim_open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=9, col=0, style='minimal', border="single", noautocmd=true}) if multigrid then screen:expect{grid=[[ @@ -8339,7 +8339,7 @@ describe('float window', function() end - meths.nvim_win_close(win, true) + api.nvim_win_close(win, true) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -8361,8 +8361,8 @@ describe('float window', function() it('it can be resized with messages and cmdheight=1', function() screen:try_resize(40,9) - local buf = meths.nvim_create_buf(false,true) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=8, col=0, style='minimal', border="single", noautocmd=true}) + local buf = api.nvim_create_buf(false,true) + local win = api.nvim_open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=8, col=0, style='minimal', border="single", noautocmd=true}) if multigrid then screen:expect{grid=[[ @@ -8469,7 +8469,7 @@ describe('float window', function() ]]} end - meths.nvim_win_close(win, true) + api.nvim_win_close(win, true) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -8495,7 +8495,7 @@ describe('float window', function() describe('no crash after moving and closing float window #21547', function() local function test_float_move_close(cmd) local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10} - meths.nvim_open_win(meths.nvim_create_buf(false, false), true, float_opts) + api.nvim_open_win(api.nvim_create_buf(false, false), true, float_opts) if multigrid then screen:expect({float_pos = {[4] = {{id = 1001}, 'NW', 1, 1, 1, true}}}) end @@ -8522,7 +8522,7 @@ describe('float window', function() it(':sleep cursor placement #22639', function() local float_opts = {relative = 'editor', row = 1, col = 1, width = 4, height = 3} - local win = meths.nvim_open_win(meths.nvim_create_buf(false, false), true, float_opts) + local win = api.nvim_open_win(api.nvim_create_buf(false, false), true, float_opts) feed('iab<CR>cd<Esc>') feed(':sleep 100') if multigrid then @@ -8590,7 +8590,7 @@ describe('float window', function() feed('<C-C>') screen:expect_unchanged() - meths.nvim_win_set_config(win, {border = 'single'}) + api.nvim_win_set_config(win, {border = 'single'}) feed(':sleep 100') if multigrid then screen:expect{grid=[[ @@ -8739,7 +8739,7 @@ describe('float window', function() it('with rightleft and border #22640', function() local float_opts = {relative='editor', width=5, height=3, row=1, col=1, border='single'} - meths.nvim_open_win(meths.nvim_create_buf(false, false), true, float_opts) + api.nvim_open_win(api.nvim_create_buf(false, false), true, float_opts) command('setlocal rightleft') feed('iabc<CR>def<Esc>') if multigrid then @@ -8778,8 +8778,8 @@ describe('float window', function() end) it('float window with hide option', function() - local buf = meths.nvim_create_buf(false,false) - local win = meths.nvim_open_win(buf, false, {relative='editor', width=10, height=2, row=2, col=5, hide = true}) + local buf = api.nvim_create_buf(false,false) + local win = api.nvim_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}, } @@ -8807,7 +8807,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {hide = false}) + api.nvim_win_set_config(win, {hide = false}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -8834,7 +8834,7 @@ describe('float window', function() ]]) end - meths.nvim_win_set_config(win, {hide=true}) + api.nvim_win_set_config(win, {hide=true}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -8860,18 +8860,18 @@ describe('float window', function() end) it(':fclose command #9663', function() - local buf_a = meths.nvim_create_buf(false,false) - local buf_b = meths.nvim_create_buf(false,false) - local buf_c = meths.nvim_create_buf(false,false) - local buf_d = meths.nvim_create_buf(false,false) + local buf_a = api.nvim_create_buf(false,false) + local buf_b = api.nvim_create_buf(false,false) + local buf_c = api.nvim_create_buf(false,false) + local buf_d = api.nvim_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.nvim_open_win(buf_a, false, config_a) - meths.nvim_open_win(buf_b, false, config_b) - meths.nvim_open_win(buf_c, false, config_c) - meths.nvim_open_win(buf_d, false, config_d) + api.nvim_open_win(buf_a, false, config_a) + api.nvim_open_win(buf_b, false, config_b) + api.nvim_open_win(buf_c, false, config_c) + api.nvim_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}, diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 08dcd18aa0..833e3833d5 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -4,8 +4,8 @@ local clear, feed, eq = helpers.clear, helpers.feed, helpers.eq local command = helpers.command local feed_command = helpers.feed_command local insert = helpers.insert -local funcs = helpers.funcs -local meths = helpers.meths +local fn = helpers.fn +local api = helpers.api local exec = helpers.exec local assert_alive = helpers.assert_alive @@ -317,7 +317,7 @@ describe('folded lines', function() feed_command('set norightleft') if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 0, 1) + api.nvim_input_mouse('left', 'press', '', 2, 0, 1) screen:expect([[ ## grid 1 [2:---------------------------------------------]|*7 @@ -330,7 +330,7 @@ describe('folded lines', function() :set norightleft | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 0, 1) + api.nvim_input_mouse('left', 'press', '', 0, 0, 1) screen:expect([[ {7:▾▸}{5:^+--- 5 lines: aa··························}| {7:│ }ff | @@ -340,7 +340,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 0, 0) + api.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect([[ ## grid 1 [2:---------------------------------------------]|*7 @@ -352,7 +352,7 @@ describe('folded lines', function() :set norightleft | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ {7:▸ }{5:^+-- 6 lines: aa···························}| {1:~ }|*6 @@ -363,7 +363,7 @@ describe('folded lines', function() -- Add a winbar to avoid double-clicks command('setlocal winbar=!!!!!!') if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 1, 0) + api.nvim_input_mouse('left', 'press', '', 2, 1, 0) screen:expect([[ ## grid 1 [2:---------------------------------------------]|*7 @@ -377,7 +377,7 @@ describe('folded lines', function() :set norightleft | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 1, 0) + api.nvim_input_mouse('left', 'press', '', 0, 1, 0) screen:expect([[ {11:!!!!!! }| {7:▾▸}{5:^+--- 5 lines: aa··························}| @@ -388,7 +388,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 1, 1) + api.nvim_input_mouse('left', 'press', '', 2, 1, 1) screen:expect([[ ## grid 1 [2:---------------------------------------------]|*7 @@ -405,7 +405,7 @@ describe('folded lines', function() :set norightleft | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 1, 1) + api.nvim_input_mouse('left', 'press', '', 0, 1, 1) screen:expect([[ {11:!!!!!! }| {7:▾▾}^aa | @@ -447,7 +447,7 @@ describe('folded lines', function() feed_command('1') feed('zf2j') if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 0, 0) + api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect([[ ## grid 1 [2:---------------------------------------------]|*2 @@ -466,7 +466,7 @@ describe('folded lines', function() {7:│}ff | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 3, 0) + api.nvim_input_mouse('left', 'press', '', 0, 3, 0) screen:expect([[ {7:-}aa | {7:-}bb | @@ -480,7 +480,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 1, 0) + api.nvim_input_mouse('left', 'press', '', 4, 1, 0) screen:expect([[ ## grid 1 [2:---------------------------------------------]|*2 @@ -499,7 +499,7 @@ describe('folded lines', function() {7:2}cc | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 4, 0) + api.nvim_input_mouse('left', 'press', '', 0, 4, 0) screen:expect([[ {7:-}aa | {7:-}bb | @@ -513,7 +513,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 1, 0) + api.nvim_input_mouse('left', 'press', '', 2, 1, 0) screen:expect([[ ## grid 1 [2:---------------------------------------------]|*2 @@ -532,7 +532,7 @@ describe('folded lines', function() {7:2}cc | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 1, 0) + api.nvim_input_mouse('left', 'press', '', 0, 1, 0) screen:expect([[ {7:-}aa | {7:+}{5:^+--- 4 lines: bb···························}| @@ -546,7 +546,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 0, 0) + api.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect([[ ## grid 1 [2:---------------------------------------------]|*2 @@ -565,7 +565,7 @@ describe('folded lines', function() {7:2}cc | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ {7:+}{5:^+-- 6 lines: aa····························}| {1:~ }| @@ -607,7 +607,7 @@ describe('folded lines', function() feed_command('1') feed('zf2j') if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 0, 0) + api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect([[ ## grid 1 [2:----------------------]{2:│}[4:----------------------]|*6 @@ -629,7 +629,7 @@ describe('folded lines', function() {1:~ }|*3 ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 0, 23) + api.nvim_input_mouse('left', 'press', '', 0, 0, 23) screen:expect([[ {7:-}aa {2:│}{7:-}^aa | {7:-}bb {2:│}{7:+}{5:+--- 4 lines: bb····}| @@ -643,7 +643,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 1, 0) + api.nvim_input_mouse('left', 'press', '', 4, 1, 0) screen:expect([[ ## grid 1 [2:----------------------]{2:│}[4:----------------------]|*6 @@ -667,7 +667,7 @@ describe('folded lines', function() {7:│}ff | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 1, 23) + api.nvim_input_mouse('left', 'press', '', 0, 1, 23) screen:expect([[ {7:-}aa {2:│}{7:-}^aa | {7:-}bb {2:│}{7:-}bb | @@ -681,7 +681,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 1, 0) + api.nvim_input_mouse('left', 'press', '', 2, 1, 0) screen:expect([[ ## grid 1 [2:----------------------]{2:│}[4:----------------------]|*6 @@ -703,7 +703,7 @@ describe('folded lines', function() {7:│}ff | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 1, 0) + api.nvim_input_mouse('left', 'press', '', 0, 1, 0) screen:expect([[ {7:-}aa {2:│}{7:-}aa | {7:+}{5:^+--- 4 lines: bb····}{2:│}{7:-}bb | @@ -717,7 +717,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 0, 0) + api.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect([[ ## grid 1 [2:----------------------]{2:│}[4:----------------------]|*6 @@ -737,7 +737,7 @@ describe('folded lines', function() {7:│}ff | ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ {7:+}{5:^+-- 6 lines: aa·····}{2:│}{7:-}aa | {1:~ }{2:│}{7:-}bb | @@ -767,7 +767,7 @@ describe('folded lines', function() feed('zO') feed_command('tab split') if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 1, 1) + api.nvim_input_mouse('left', 'press', '', 4, 1, 1) screen:expect([[ ## grid 1 {10: + [No Name] }{11: + [No Name] }{2: }{10:X}| @@ -790,7 +790,7 @@ describe('folded lines', function() {1:~ }|*3 ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 2, 1) + api.nvim_input_mouse('left', 'press', '', 0, 2, 1) screen:expect([[ {10: + [No Name] }{11: + [No Name] }{2: }{10:X}| {7:- }^aa | @@ -802,7 +802,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 0, 0) + api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect([[ ## grid 1 {10: + [No Name] }{11: + [No Name] }{2: }{10:X}| @@ -823,7 +823,7 @@ describe('folded lines', function() {1:~ }|*5 ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 1, 0) + api.nvim_input_mouse('left', 'press', '', 0, 1, 0) screen:expect([[ {10: + [No Name] }{11: + [No Name] }{2: }{10:X}| {7:+ }{5:^+-- 6 lines: aa···························}| @@ -834,7 +834,7 @@ describe('folded lines', function() feed_command('tabnext') if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 1, 1) + api.nvim_input_mouse('left', 'press', '', 2, 1, 1) screen:expect([[ ## grid 1 {11: + [No Name] }{10: + [No Name] }{2: }{10:X}| @@ -852,7 +852,7 @@ describe('folded lines', function() {1:~ }|*5 ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 2, 1) + api.nvim_input_mouse('left', 'press', '', 0, 2, 1) screen:expect([[ {11: + [No Name] }{10: + [No Name] }{2: }{10:X}| {7:- }^aa | @@ -864,7 +864,7 @@ describe('folded lines', function() end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 0, 0) + api.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect([[ ## grid 1 {11: + [No Name] }{10: + [No Name] }{2: }{10:X}| @@ -880,7 +880,7 @@ describe('folded lines', function() {1:~ }|*5 ]]) else - meths.nvim_input_mouse('left', 'press', '', 0, 1, 0) + api.nvim_input_mouse('left', 'press', '', 0, 1, 0) screen:expect([[ {11: + [No Name] }{10: + [No Name] }{2: }{10:X}| {7:+ }{5:^+-- 6 lines: aa···························}| @@ -891,7 +891,7 @@ describe('folded lines', function() end) it('works with multibyte text', function() - eq(true, meths.nvim_get_option_value('arabicshape', {})) + eq(true, api.nvim_get_option_value('arabicshape', {})) insert([[ å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢͟ العَرَبِيَّة möre text]]) @@ -1232,10 +1232,10 @@ describe('folded lines', function() end) it('work with autoresize', function() - funcs.setline(1, 'line 1') - funcs.setline(2, 'line 2') - funcs.setline(3, 'line 3') - funcs.setline(4, 'line 4') + fn.setline(1, 'line 1') + fn.setline(2, 'line 2') + fn.setline(3, 'line 3') + fn.setline(4, 'line 4') feed('zfj') command('set foldcolumn=0') @@ -1526,34 +1526,34 @@ describe('folded lines', function() end) it('fold attached virtual lines are drawn and scrolled correctly #21837', function() - funcs.setline(1, 'line 1') - funcs.setline(2, 'line 2') - funcs.setline(3, 'line 3') - funcs.setline(4, 'line 4') + fn.setline(1, 'line 1') + fn.setline(2, 'line 2') + fn.setline(3, 'line 3') + fn.setline(4, 'line 4') feed('zfj') - local ns = meths.nvim_create_namespace('ns') - meths.nvim_buf_set_extmark( + local ns = api.nvim_create_namespace('ns') + api.nvim_buf_set_extmark( 0, ns, 0, 0, { virt_lines_above = true, virt_lines = { { { 'virt_line above line 1', '' } } } } ) - meths.nvim_buf_set_extmark( + api.nvim_buf_set_extmark( 0, ns, 1, 0, { virt_lines = { { { 'virt_line below line 2', '' } } } } ) - meths.nvim_buf_set_extmark( + api.nvim_buf_set_extmark( 0, ns, 2, 0, { virt_lines_above = true, virt_lines = { { { 'virt_line above line 3', '' } } } } ) - meths.nvim_buf_set_extmark( + api.nvim_buf_set_extmark( 0, ns, 3, @@ -1636,7 +1636,7 @@ describe('folded lines', function() end feed('kzo<C-Y>') - funcs.setline(5, 'line 5') + fn.setline(5, 'line 5') if multigrid then screen:expect { grid = [[ @@ -1679,7 +1679,7 @@ describe('folded lines', function() ]]) end - meths.nvim_input_mouse('left', 'press', '', multigrid and 2 or 0, 4, 0) + api.nvim_input_mouse('left', 'press', '', multigrid and 2 or 0, 4, 0) eq({ screencol = 1, screenrow = 5, @@ -1689,9 +1689,9 @@ describe('folded lines', function() line = 3, column = 1, coladd = 0, - }, funcs.getmousepos()) + }, fn.getmousepos()) - meths.nvim_buf_set_extmark( + api.nvim_buf_set_extmark( 0, ns, 1, @@ -1965,7 +1965,7 @@ describe('folded lines', function() ]]) end - meths.nvim_input_mouse('left', 'press', '3', multigrid and 2 or 0, 3, 0) + api.nvim_input_mouse('left', 'press', '3', multigrid and 2 or 0, 3, 0) if multigrid then screen:expect { grid = [[ @@ -2004,7 +2004,7 @@ describe('folded lines', function() ]]) end - meths.nvim_input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 0) + api.nvim_input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 0) if multigrid then screen:expect { grid = [[ @@ -2041,7 +2041,7 @@ describe('folded lines', function() ]]) end - meths.nvim_input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 5) + api.nvim_input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 5) if multigrid then screen:expect { grid = [[ @@ -2400,7 +2400,7 @@ describe('folded lines', function() ]]) end feed('<Esc>') - funcs.matchadd('Search', 'line') + fn.matchadd('Search', 'line') if multigrid then screen:expect([[ ## grid 1 @@ -2431,9 +2431,9 @@ describe('folded lines', function() command('hi! CursorLine guibg=NONE guifg=Red gui=NONE') command('hi F0 guibg=Red guifg=Black') command('hi F1 guifg=White') - meths.nvim_set_option_value('cursorline', true, {}) - meths.nvim_set_option_value('foldcolumn', '4', {}) - meths.nvim_set_option_value( + api.nvim_set_option_value('cursorline', true, {}) + api.nvim_set_option_value('foldcolumn', '4', {}) + api.nvim_set_option_value( 'foldtext', '[' .. '["▶", ["F0", "F1"]], ' @@ -2466,7 +2466,7 @@ describe('folded lines', function() | ]]) end - eq('▶-\tvalid English', funcs.foldtextresult(2)) + eq('▶-\tvalid English', fn.foldtextresult(2)) feed('zo') if multigrid then @@ -2493,8 +2493,8 @@ describe('folded lines', function() | ]]) end - eq('▶--\tsentence composed by', funcs.foldtextresult(3)) - eq('▶--\tin his cave.', funcs.foldtextresult(5)) + eq('▶--\tsentence composed by', fn.foldtextresult(3)) + eq('▶--\tin his cave.', fn.foldtextresult(5)) command('hi! Visual guibg=Red') feed('V2k') @@ -2523,7 +2523,7 @@ describe('folded lines', function() ]]) end - meths.nvim_set_option_value('rightleft', true, {}) + api.nvim_set_option_value('rightleft', true, {}) if multigrid then screen:expect([[ ## grid 1 diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index c2a7317da0..fc692f47bb 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -5,8 +5,8 @@ local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local command, exec = helpers.command, helpers.exec local eval = helpers.eval local feed_command, eq = helpers.feed_command, helpers.eq -local funcs = helpers.funcs -local meths = helpers.meths +local fn = helpers.fn +local api = helpers.api local exec_lua = helpers.exec_lua describe('colorscheme compatibility', function() @@ -15,8 +15,8 @@ describe('colorscheme compatibility', function() end) it('&t_Co exists and is set to 256 by default', function() - eq(1, funcs.exists('&t_Co')) - eq(1, funcs.exists('+t_Co')) + eq(1, fn.exists('&t_Co')) + eq(1, fn.exists('+t_Co')) eq('256', eval('&t_Co')) end) end) @@ -2087,7 +2087,7 @@ describe("'winhighlight' highlight", function() end) it('can override NonText, Conceal and EndOfBuffer', function() - meths.nvim_buf_set_lines(0, 0, -1, true, { 'raa\000' }) + api.nvim_buf_set_lines(0, 0, -1, true, { 'raa\000' }) command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})') command('set cole=2 cocu=nvic') command('split') @@ -2402,13 +2402,13 @@ describe('highlight namespaces', function() [10] = { bold = true, foreground = Screen.colors.SeaGreen }, } - ns1 = meths.nvim_create_namespace 'grungy' - ns2 = meths.nvim_create_namespace 'ultrared' + ns1 = api.nvim_create_namespace 'grungy' + ns2 = api.nvim_create_namespace 'ultrared' - meths.nvim_set_hl(ns1, 'Normal', { bg = 'DarkGrey' }) - meths.nvim_set_hl(ns1, 'NonText', { bg = 'DarkOrange4', fg = 'DarkCyan', italic = true }) - meths.nvim_set_hl(ns2, 'Normal', { bg = 'DarkMagenta' }) - meths.nvim_set_hl(ns2, 'NonText', { fg = 'Crimson' }) + api.nvim_set_hl(ns1, 'Normal', { bg = 'DarkGrey' }) + api.nvim_set_hl(ns1, 'NonText', { bg = 'DarkOrange4', fg = 'DarkCyan', italic = true }) + api.nvim_set_hl(ns2, 'Normal', { bg = 'DarkMagenta' }) + api.nvim_set_hl(ns2, 'NonText', { fg = 'Crimson' }) end) it('can be used globally', function() @@ -2420,7 +2420,7 @@ describe('highlight namespaces', function() ]], } - meths.nvim_set_hl_ns(ns1) + api.nvim_set_hl_ns(ns1) screen:expect { grid = [[ {2:^ }| @@ -2429,7 +2429,7 @@ describe('highlight namespaces', function() ]], } - meths.nvim_set_hl_ns(ns2) + api.nvim_set_hl_ns(ns2) screen:expect { grid = [[ {4:^ }| @@ -2438,7 +2438,7 @@ describe('highlight namespaces', function() ]], } - meths.nvim_set_hl_ns(0) + api.nvim_set_hl_ns(0) screen:expect { grid = [[ ^ | @@ -2449,13 +2449,13 @@ describe('highlight namespaces', function() end) it('can be used per window', function() - local win1 = meths.nvim_get_current_win() + local win1 = api.nvim_get_current_win() command 'split' - local win2 = meths.nvim_get_current_win() + local win2 = api.nvim_get_current_win() command 'split' - meths.nvim_win_set_hl_ns(win1, ns1) - meths.nvim_win_set_hl_ns(win2, ns2) + api.nvim_win_set_hl_ns(win1, ns1) + api.nvim_win_set_hl_ns(win2, ns2) screen:expect { grid = [[ @@ -2482,7 +2482,7 @@ describe('highlight namespaces', function() ]], } - meths.nvim_set_hl(0, 'EndOfBuffer', { fg = '#333333' }) + api.nvim_set_hl(0, 'EndOfBuffer', { fg = '#333333' }) screen:expect { grid = [[ ^ | @@ -2507,7 +2507,7 @@ describe('highlight namespaces', function() it('Normal in set_hl #25474', function() command('highlight Ignore guifg=bg ctermfg=White') - meths.nvim_set_hl(0, 'Normal', { bg = '#333333' }) + api.nvim_set_hl(0, 'Normal', { bg = '#333333' }) command('highlight Ignore') screen:expect { grid = [[ diff --git a/test/functional/ui/hlstate_spec.lua b/test/functional/ui/hlstate_spec.lua index d6fd864536..278e6e5272 100644 --- a/test/functional/ui/hlstate_spec.lua +++ b/test/functional/ui/hlstate_spec.lua @@ -3,7 +3,7 @@ local Screen = require('test.functional.ui.screen') local clear, insert = helpers.clear, helpers.insert local command = helpers.command -local meths = helpers.meths +local api = helpers.api local testprg = helpers.testprg local thelpers = require('test.functional.terminal.helpers') local skip = helpers.skip @@ -28,8 +28,8 @@ describe('ext_hlstate detailed highlights', function() insert([[ these are some lines with colorful text]]) - meths.nvim_buf_add_highlight(0, -1, 'String', 0, 10, 14) - meths.nvim_buf_add_highlight(0, -1, 'Statement', 1, 5, -1) + api.nvim_buf_add_highlight(0, -1, 'String', 0, 10, 14) + api.nvim_buf_add_highlight(0, -1, 'Statement', 1, 5, -1) command('/th co') screen:expect( diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index e82f889553..f4347a460e 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -7,8 +7,8 @@ local eval = helpers.eval local expect = helpers.expect local feed = helpers.feed local insert = helpers.insert -local funcs = helpers.funcs -local meths = helpers.meths +local fn = helpers.fn +local api = helpers.api local neq = helpers.neq local ok = helpers.ok local retry = helpers.retry @@ -157,19 +157,19 @@ describe(":substitute, 'inccommand' preserves", function() common_setup(screen, 'nosplit', ('abc\ndef\n'):rep(50)) feed('ggyG') - local X = meths.nvim_get_vvar('maxcol') - eq({ 0, 1, 1, 0 }, funcs.getpos("'[")) - eq({ 0, 101, X, 0 }, funcs.getpos("']")) + local X = api.nvim_get_vvar('maxcol') + eq({ 0, 1, 1, 0 }, fn.getpos("'[")) + eq({ 0, 101, X, 0 }, fn.getpos("']")) feed(":'[,']s/def/") poke_eventloop() - eq({ 0, 1, 1, 0 }, funcs.getpos("'[")) - eq({ 0, 101, X, 0 }, funcs.getpos("']")) + eq({ 0, 1, 1, 0 }, fn.getpos("'[")) + eq({ 0, 101, X, 0 }, fn.getpos("']")) feed('DEF/g') poke_eventloop() - eq({ 0, 1, 1, 0 }, funcs.getpos("'[")) - eq({ 0, 101, X, 0 }, funcs.getpos("']")) + eq({ 0, 1, 1, 0 }, fn.getpos("'[")) + eq({ 0, 101, X, 0 }, fn.getpos("']")) feed('<CR>') expect(('abc\nDEF\n'):rep(50)) @@ -204,8 +204,8 @@ describe(":substitute, 'inccommand' preserves", function() feed(':%s/as/glork/') poke_eventloop() feed('<enter>') - eq(meths.nvim_get_option_value('undolevels', { scope = 'global' }), 139) - eq(meths.nvim_get_option_value('undolevels', { buf = 0 }), 34) + eq(api.nvim_get_option_value('undolevels', { scope = 'global' }), 139) + eq(api.nvim_get_option_value('undolevels', { buf = 0 }), 34) end) end @@ -1098,7 +1098,7 @@ describe(':substitute, inccommand=split', function() feed('<CR>') poke_eventloop() feed(':vs tmp<enter>') - eq(3, funcs.bufnr('$')) + eq(3, fn.bufnr('$')) end) it('works with the n flag', function() @@ -1118,7 +1118,7 @@ describe(':substitute, inccommand=split', function() it("deactivates if 'redrawtime' is exceeded #5602", function() -- prevent redraws from 'incsearch' - meths.nvim_set_option_value('incsearch', false, {}) + api.nvim_set_option_value('incsearch', false, {}) -- Assert that 'inccommand' is ENABLED initially. eq('split', eval('&inccommand')) -- Set 'redrawtime' to minimal value, to ensure timeout is triggered. @@ -1751,7 +1751,7 @@ describe("'inccommand' autocommands", function() end local function register_autocmd(event) - meths.nvim_set_var(event .. '_fired', {}) + api.nvim_set_var(event .. '_fired', {}) command('autocmd ' .. event .. ' * call add(g:' .. event .. "_fired, expand('<abuf>'))") end @@ -1767,14 +1767,14 @@ describe("'inccommand' autocommands", function() feed(':%s/tw') for event, _ in pairs(eventsExpected) do - eventsObserved[event].open = meths.nvim_get_var(event .. '_fired') - meths.nvim_set_var(event .. '_fired', {}) + eventsObserved[event].open = api.nvim_get_var(event .. '_fired') + api.nvim_set_var(event .. '_fired', {}) end feed('/<enter>') for event, _ in pairs(eventsExpected) do - eventsObserved[event].close = meths.nvim_get_var(event .. '_fired') + eventsObserved[event].close = api.nvim_get_var(event .. '_fired') end for event, _ in pairs(eventsExpected) do @@ -1897,20 +1897,20 @@ describe("'inccommand' with 'gdefault'", function() common_setup(nil, 'nosplit', '{') command('set gdefault') feed(':s/{\\n') - eq({ mode = 'c', blocking = false }, meths.nvim_get_mode()) + eq({ mode = 'c', blocking = false }, api.nvim_get_mode()) feed('/A<Enter>') expect('A') - eq({ mode = 'n', blocking = false }, meths.nvim_get_mode()) + eq({ mode = 'n', blocking = false }, api.nvim_get_mode()) end) it('with multiline text and range, does not lock up #7244', function() common_setup(nil, 'nosplit', '{\n\n{') command('set gdefault') feed(':%s/{\\n') - eq({ mode = 'c', blocking = false }, meths.nvim_get_mode()) + eq({ mode = 'c', blocking = false }, api.nvim_get_mode()) feed('/A<Enter>') expect('A\nA') - eq({ mode = 'n', blocking = false }, meths.nvim_get_mode()) + eq({ mode = 'n', blocking = false }, api.nvim_get_mode()) end) it('does not crash on zero-width matches #7485', function() @@ -1919,9 +1919,9 @@ describe("'inccommand' with 'gdefault'", function() feed('gg') feed('Vj') feed(':s/\\%V') - eq({ mode = 'c', blocking = false }, meths.nvim_get_mode()) + eq({ mode = 'c', blocking = false }, api.nvim_get_mode()) feed('<Esc>') - eq({ mode = 'n', blocking = false }, meths.nvim_get_mode()) + eq({ mode = 'n', blocking = false }, api.nvim_get_mode()) end) it('removes highlights after abort for a zero-width match', function() @@ -2613,8 +2613,8 @@ it(':substitute with inccommand, allows :redraw before first separator is typed local screen = Screen.new(30, 6) common_setup(screen, 'split', 'foo bar baz\nbar baz fox\nbar foo baz') command('hi! link NormalFloat CursorLine') - local float_buf = meths.nvim_create_buf(false, true) - meths.nvim_open_win(float_buf, false, { + local float_buf = api.nvim_create_buf(false, true) + api.nvim_open_win(float_buf, false, { relative = 'editor', height = 1, width = 5, @@ -2640,7 +2640,7 @@ it(':substitute with inccommand, allows :redraw before first separator is typed {15:~ }| :%s^ | ]]) - meths.nvim_buf_set_lines(float_buf, 0, -1, true, { 'foo' }) + api.nvim_buf_set_lines(float_buf, 0, -1, true, { 'foo' }) command('redraw') screen:expect([[ foo bar baz | @@ -2744,7 +2744,7 @@ it(':substitute with inccommand works properly if undo is not synced #20029', fu clear() local screen = Screen.new(30, 6) common_setup(screen, 'nosplit', 'foo\nbar\nbaz') - meths.nvim_set_keymap('x', '<F2>', '<Esc>`<Oaaaaa asdf<Esc>`>obbbbb asdf<Esc>V`<k:s/asdf/', {}) + api.nvim_set_keymap('x', '<F2>', '<Esc>`<Oaaaaa asdf<Esc>`>obbbbb asdf<Esc>V`<k:s/asdf/', {}) feed('gg0<C-V>lljj<F2>') screen:expect([[ aaaaa | diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua index 8a08d459c4..80862b668f 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -4,10 +4,10 @@ local feed, next_msg, eq = helpers.feed, helpers.next_msg, helpers.eq local command = helpers.command local expect = helpers.expect local curbuf_contents = helpers.curbuf_contents -local meths = helpers.meths +local api = helpers.api local exec_lua = helpers.exec_lua local write_file = helpers.write_file -local funcs = helpers.funcs +local fn = helpers.fn local eval = helpers.eval local Screen = require('test.functional.ui.screen') @@ -244,7 +244,7 @@ it('Ctrl-6 is Ctrl-^ vim-patch:8.1.2333', function() command('split aaa') command('edit bbb') feed('<C-6>') - eq('aaa', funcs.bufname()) + eq('aaa', fn.bufname()) end) it('c_CTRL-R_CTRL-R, i_CTRL-R_CTRL-R, i_CTRL-G_CTRL-K work properly vim-patch:8.1.2346', function() @@ -303,7 +303,7 @@ it('unsimplified mapping works when there was a partial match vim-patch:8.2.4504 command('nnoremap <C-J> a') command('nnoremap <NL> x') command('nnoremap <C-J>x <Nop>') - funcs.setline(1, 'x') + fn.setline(1, 'x') -- CTRL-J b should have trigger the <C-J> mapping and then insert "b" feed('<C-J>b<Esc>') expect('xb') @@ -392,7 +392,7 @@ end) describe('event processing and input', function() it('not blocked by event bursts', function() - meths.nvim_set_keymap( + api.nvim_set_keymap( '', '<f2>', "<cmd>lua vim.rpcnotify(1, 'stop') winning = true <cr>", diff --git a/test/functional/ui/linematch_spec.lua b/test/functional/ui/linematch_spec.lua index 98ada8f6c4..40df5cadf1 100644 --- a/test/functional/ui/linematch_spec.lua +++ b/test/functional/ui/linematch_spec.lua @@ -1118,9 +1118,9 @@ describe('regressions', function() screen = Screen.new(100, 20) screen:attach() -- line must be greater than MATCH_CHAR_MAX_LEN - helpers.meths.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1000) .. 'hello' }) + helpers.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1000) .. 'hello' }) helpers.exec 'vnew' - helpers.meths.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1010) .. 'world' }) + helpers.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1010) .. 'world' }) helpers.exec 'windo diffthis' end) @@ -1133,9 +1133,9 @@ describe('regressions', function() for i = 0, 29 do lines[#lines + 1] = tostring(i) end - helpers.meths.nvim_buf_set_lines(0, 0, -1, false, lines) + helpers.api.nvim_buf_set_lines(0, 0, -1, false, lines) helpers.exec 'vnew' - helpers.meths.nvim_buf_set_lines(0, 0, -1, false, { '00', '29' }) + helpers.api.nvim_buf_set_lines(0, 0, -1, false, { '00', '29' }) helpers.exec 'windo diffthis' feed('<C-e>') screen:expect { diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 25ae74daf1..4f95cd909c 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -5,7 +5,7 @@ local eval = helpers.eval local eq = helpers.eq local command = helpers.command local set_method_error = helpers.set_method_error -local meths = helpers.meths +local api = helpers.api local async_meths = helpers.async_meths local test_build_dir = helpers.test_build_dir local nvim_prog = helpers.nvim_prog @@ -17,7 +17,7 @@ local poke_eventloop = helpers.poke_eventloop local assert_alive = helpers.assert_alive local is_os = helpers.is_os local is_ci = helpers.is_ci -local funcs = helpers.funcs +local fn = helpers.fn local skip = helpers.skip describe('ui/ext_messages', function() @@ -1445,7 +1445,7 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim it('prints lines in Ex mode correctly with a burst of carriage returns #19341', function() command('set number') - meths.nvim_buf_set_lines(0, 0, 0, true, { 'aaa', 'bbb', 'ccc' }) + api.nvim_buf_set_lines(0, 0, 0, true, { 'aaa', 'bbb', 'ccc' }) feed('gggQ<CR><CR>1<CR><CR>vi') screen:expect([[ Entering Ex mode. Type "visual" to go to Normal mode. | @@ -1542,7 +1542,7 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim {1:~ }|*5 | ]]) - eq(1, meths.nvim_get_option_value('cmdheight', {})) + eq(1, api.nvim_get_option_value('cmdheight', {})) end) it('using nvim_echo in VimResized does not cause hit-enter prompt #26139', function() @@ -1553,7 +1553,7 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim {1:~ }|*3 | ]]) - eq({ mode = 'n', blocking = false }, meths.nvim_get_mode()) + eq({ mode = 'n', blocking = false }, api.nvim_get_mode()) end) end) @@ -1675,9 +1675,9 @@ describe('ui/ext_messages', function() }) feed(':set mouse=a<cr>') - meths.nvim_input_mouse('left', 'press', '', 0, 12, 10) + api.nvim_input_mouse('left', 'press', '', 0, 12, 10) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 0, 11, 10) + api.nvim_input_mouse('left', 'drag', '', 0, 11, 10) feed('<c-l>') feed(':set cmdheight<cr>') screen:expect({ @@ -2183,7 +2183,7 @@ aliquip ex ea commodo consequat.]] end) it('with :!cmd does not crash on resize', function() - skip(funcs.executable('sleep') == 0, 'missing "sleep" command') + skip(fn.executable('sleep') == 0, 'missing "sleep" command') feed(':!sleep 1<cr>') screen:expect { grid = [[ diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index f3025c0d53..a7710ab584 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1,8 +1,8 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, meths = helpers.clear, helpers.feed, helpers.meths +local clear, feed, api = helpers.clear, helpers.feed, helpers.api local insert, feed_command = helpers.insert, helpers.feed_command -local eq, funcs = helpers.eq, helpers.funcs +local eq, fn = helpers.eq, helpers.fn local poke_eventloop = helpers.poke_eventloop local command = helpers.command local exec = helpers.exec @@ -12,8 +12,8 @@ describe('ui/mouse/input', function() before_each(function() clear() - meths.nvim_set_option_value('mouse', 'a', {}) - meths.nvim_set_option_value('list', true, {}) + api.nvim_set_option_value('mouse', 'a', {}) + api.nvim_set_option_value('list', true, {}) -- NB: this is weird, but mostly irrelevant to the test -- So I didn't bother to change it command('set listchars=eol:$') @@ -69,7 +69,7 @@ describe('ui/mouse/input', function() end) it("in external ui works with unset 'mouse'", function() - meths.nvim_set_option_value('mouse', '', {}) + api.nvim_set_option_value('mouse', '', {}) feed('<LeftMouse><2,1>') screen:expect { grid = [[ @@ -379,7 +379,7 @@ describe('ui/mouse/input', function() end) it('left click in default tabline (position 24) closes tab', function() - meths.nvim_set_option_value('hidden', true, {}) + api.nvim_set_option_value('hidden', true, {}) feed_command('%delete') insert('this is foo') feed_command('silent file foo | tabnew | file bar') @@ -399,7 +399,7 @@ describe('ui/mouse/input', function() end) it('double click in default tabline (position 4) opens new tab', function() - meths.nvim_set_option_value('hidden', true, {}) + api.nvim_set_option_value('hidden', true, {}) feed_command('%delete') insert('this is foo') feed_command('silent file foo | tabnew | file bar') @@ -432,8 +432,8 @@ describe('ui/mouse/input', function() return call('Test', a:000 + [2]) endfunction ]]) - meths.nvim_set_option_value('tabline', '%@Test@test%X-%5@Test2@test2', {}) - meths.nvim_set_option_value('showtabline', 2, {}) + api.nvim_set_option_value('tabline', '%@Test@test%X-%5@Test2@test2', {}) + api.nvim_set_option_value('showtabline', 2, {}) screen:expect([[ {fill:test-test2 }| testing | @@ -441,17 +441,17 @@ describe('ui/mouse/input', function() support and selectio^n | | ]]) - meths.nvim_set_var('reply', {}) + api.nvim_set_var('reply', {}) end) local check_reply = function(expected) - eq(expected, meths.nvim_get_var('reply')) - meths.nvim_set_var('reply', {}) + eq(expected, api.nvim_get_var('reply')) + api.nvim_set_var('reply', {}) end local test_click = function(name, click_str, click_num, mouse_button, modifiers) local function doit(do_click) - eq(1, funcs.has('tablineat')) + eq(1, fn.has('tablineat')) do_click(0, 3) check_reply({ 0, click_num, mouse_button, modifiers }) do_click(0, 4) @@ -475,7 +475,7 @@ describe('ui/mouse/input', function() for char in string.gmatch(modifiers, '%w') do modstr = modstr .. char .. '-' -- - not needed but should be accepted end - meths.nvim_input_mouse(buttons[mouse_button], 'press', modstr, 0, row, col) + api.nvim_input_mouse(buttons[mouse_button], 'press', modstr, 0, row, col) end) end) end @@ -609,7 +609,7 @@ describe('ui/mouse/input', function() ]], } - meths.nvim_input_mouse('left', 'press', '', 0, 6, 27) + api.nvim_input_mouse('left', 'press', '', 0, 6, 27) screen:expect { grid = [[ testing │testing | @@ -624,7 +624,7 @@ describe('ui/mouse/input', function() | ]], } - meths.nvim_input_mouse('left', 'drag', '', 0, 7, 30) + api.nvim_input_mouse('left', 'drag', '', 0, 7, 30) screen:expect { grid = [[ @@ -779,7 +779,7 @@ describe('ui/mouse/input', function() end) it('ctrl + left click will search for a tag', function() - meths.nvim_set_option_value('tags', './non-existent-tags-file', {}) + api.nvim_set_option_value('tags', './non-existent-tags-file', {}) feed('<C-LeftMouse><0,0>') screen:expect([[ {6:E433: No tags file} | @@ -792,28 +792,28 @@ describe('ui/mouse/input', function() end) it('x1 and x2 can be triggered by api', function() - meths.nvim_set_var('x1_pressed', 0) - meths.nvim_set_var('x1_released', 0) - meths.nvim_set_var('x2_pressed', 0) - meths.nvim_set_var('x2_released', 0) + api.nvim_set_var('x1_pressed', 0) + api.nvim_set_var('x1_released', 0) + api.nvim_set_var('x2_pressed', 0) + api.nvim_set_var('x2_released', 0) command('nnoremap <X1Mouse> <Cmd>let g:x1_pressed += 1<CR>') command('nnoremap <X1Release> <Cmd>let g:x1_released += 1<CR>') command('nnoremap <X2Mouse> <Cmd>let g:x2_pressed += 1<CR>') command('nnoremap <X2Release> <Cmd>let g:x2_released += 1<CR>') - meths.nvim_input_mouse('x1', 'press', '', 0, 0, 0) - meths.nvim_input_mouse('x1', 'release', '', 0, 0, 0) - meths.nvim_input_mouse('x2', 'press', '', 0, 0, 0) - meths.nvim_input_mouse('x2', 'release', '', 0, 0, 0) - eq(1, meths.nvim_get_var('x1_pressed'), 'x1 pressed once') - eq(1, meths.nvim_get_var('x1_released'), 'x1 released once') - eq(1, meths.nvim_get_var('x2_pressed'), 'x2 pressed once') - eq(1, meths.nvim_get_var('x2_released'), 'x2 released once') + api.nvim_input_mouse('x1', 'press', '', 0, 0, 0) + api.nvim_input_mouse('x1', 'release', '', 0, 0, 0) + api.nvim_input_mouse('x2', 'press', '', 0, 0, 0) + api.nvim_input_mouse('x2', 'release', '', 0, 0, 0) + eq(1, api.nvim_get_var('x1_pressed'), 'x1 pressed once') + eq(1, api.nvim_get_var('x1_released'), 'x1 released once') + eq(1, api.nvim_get_var('x2_pressed'), 'x2 pressed once') + eq(1, api.nvim_get_var('x2_released'), 'x2 released once') end) it('dragging vertical separator', function() screen:try_resize(45, 5) command('setlocal nowrap') - local oldwin = meths.nvim_get_current_win().id + local oldwin = api.nvim_get_current_win().id command('rightbelow vnew') screen:expect([[ testing │{0:^$} | @@ -822,9 +822,9 @@ describe('ui/mouse/input', function() {4:[No Name] [+] }{5:[No Name] }| | ]]) - meths.nvim_input_mouse('left', 'press', '', 0, 0, 22) + api.nvim_input_mouse('left', 'press', '', 0, 0, 22) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 0, 1, 12) + api.nvim_input_mouse('left', 'drag', '', 0, 1, 12) screen:expect([[ testing │{0:^$} | mouse │{0:~ }| @@ -832,7 +832,7 @@ describe('ui/mouse/input', function() {4:< Name] [+] }{5:[No Name] }| | ]]) - meths.nvim_input_mouse('left', 'drag', '', 0, 2, 2) + api.nvim_input_mouse('left', 'drag', '', 0, 2, 2) screen:expect([[ te│{0:^$} | mo│{0:~ }| @@ -840,17 +840,17 @@ describe('ui/mouse/input', function() {4:< }{5:[No Name] }| | ]]) - meths.nvim_input_mouse('left', 'release', '', 0, 2, 2) - meths.nvim_set_option_value('statuscolumn', 'foobar', { win = oldwin }) + api.nvim_input_mouse('left', 'release', '', 0, 2, 2) + api.nvim_set_option_value('statuscolumn', 'foobar', { win = oldwin }) screen:expect([[ {8:fo}│{0:^$} | {8:fo}│{0:~ }|*2 {4:< }{5:[No Name] }| | ]]) - meths.nvim_input_mouse('left', 'press', '', 0, 0, 2) + api.nvim_input_mouse('left', 'press', '', 0, 0, 2) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 0, 1, 12) + api.nvim_input_mouse('left', 'drag', '', 0, 1, 12) screen:expect([[ {8:foobar}testin│{0:^$} | {8:foobar}mouse │{0:~ }| @@ -858,7 +858,7 @@ describe('ui/mouse/input', function() {4:< Name] [+] }{5:[No Name] }| | ]]) - meths.nvim_input_mouse('left', 'drag', '', 0, 2, 22) + api.nvim_input_mouse('left', 'drag', '', 0, 2, 22) screen:expect([[ {8:foobar}testing │{0:^$} | {8:foobar}mouse │{0:~ }| @@ -866,7 +866,7 @@ describe('ui/mouse/input', function() {4:[No Name] [+] }{5:[No Name] }| | ]]) - meths.nvim_input_mouse('left', 'release', '', 0, 2, 22) + api.nvim_input_mouse('left', 'release', '', 0, 2, 22) end) local function wheel(use_api) @@ -901,7 +901,7 @@ describe('ui/mouse/input', function() :vsp | ]]) if use_api then - meths.nvim_input_mouse('wheel', 'down', '', 0, 0, 0) + api.nvim_input_mouse('wheel', 'down', '', 0, 0, 0) else feed('<ScrollWheelDown><0,0>') end @@ -922,7 +922,7 @@ describe('ui/mouse/input', function() :vsp | ]]) if use_api then - meths.nvim_input_mouse('wheel', 'up', '', 0, 0, 27) + api.nvim_input_mouse('wheel', 'up', '', 0, 0, 27) else feed('<ScrollWheelUp><27,0>') end @@ -943,8 +943,8 @@ describe('ui/mouse/input', function() :vsp | ]]) if use_api then - meths.nvim_input_mouse('wheel', 'up', '', 0, 7, 27) - meths.nvim_input_mouse('wheel', 'up', '', 0, 7, 27) + api.nvim_input_mouse('wheel', 'up', '', 0, 7, 27) + api.nvim_input_mouse('wheel', 'up', '', 0, 7, 27) else feed('<ScrollWheelUp><27,7><ScrollWheelUp>') end @@ -1016,7 +1016,7 @@ describe('ui/mouse/input', function() | ]]) - meths.nvim_input_mouse('wheel', 'left', '', 0, 0, 27) + api.nvim_input_mouse('wheel', 'left', '', 0, 0, 27) screen:expect([[ |*2 n bbbbbbbbbbbbbbbbbbb^b | @@ -1025,7 +1025,7 @@ describe('ui/mouse/input', function() ]]) feed('^') - meths.nvim_input_mouse('wheel', 'right', '', 0, 0, 0) + api.nvim_input_mouse('wheel', 'right', '', 0, 0, 0) screen:expect([[ g | | @@ -1048,7 +1048,7 @@ describe('ui/mouse/input', function() | ]]) - meths.nvim_input_mouse('wheel', 'right', '', 0, 0, 27) + api.nvim_input_mouse('wheel', 'right', '', 0, 0, 27) screen:expect([[ g | | @@ -1068,7 +1068,7 @@ describe('ui/mouse/input', function() | ]]) - meths.nvim_input_mouse('wheel', 'right', '', 0, 0, 27) + api.nvim_input_mouse('wheel', 'right', '', 0, 0, 27) screen:expect([[ g | | @@ -1605,39 +1605,39 @@ describe('ui/mouse/input', function() describe('(matchadd())', function() before_each(function() - funcs.matchadd('Conceal', [[\*]]) - funcs.matchadd('Conceal', [[cats]], 10, -1, { conceal = 'X' }) - funcs.matchadd('Conceal', [[\n\@<=x]], 10, -1, { conceal = '>' }) + fn.matchadd('Conceal', [[\*]]) + fn.matchadd('Conceal', [[cats]], 10, -1, { conceal = 'X' }) + fn.matchadd('Conceal', [[\n\@<=x]], 10, -1, { conceal = '>' }) end) test_mouse_click_conceal() end) describe('(extmarks)', function() before_each(function() - local ns = meths.nvim_create_namespace('conceal') - meths.nvim_buf_set_extmark(0, ns, 0, 11, { end_col = 12, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 0, 14, { end_col = 15, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 1, 5, { end_col = 6, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 1, 8, { end_col = 9, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 1, 10, { end_col = 11, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 1, 13, { end_col = 14, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 1, 15, { end_col = 16, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 1, 18, { end_col = 19, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 2, 24, { end_col = 25, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 2, 29, { end_col = 30, conceal = '' }) - meths.nvim_buf_set_extmark(0, ns, 2, 25, { end_col = 29, conceal = 'X' }) - meths.nvim_buf_set_extmark(0, ns, 2, 0, { end_col = 1, conceal = '>' }) + local ns = api.nvim_create_namespace('conceal') + api.nvim_buf_set_extmark(0, ns, 0, 11, { end_col = 12, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 0, 14, { end_col = 15, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 1, 5, { end_col = 6, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 1, 8, { end_col = 9, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 1, 10, { end_col = 11, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 1, 13, { end_col = 14, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 1, 15, { end_col = 16, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 1, 18, { end_col = 19, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 2, 24, { end_col = 25, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 2, 29, { end_col = 30, conceal = '' }) + api.nvim_buf_set_extmark(0, ns, 2, 25, { end_col = 29, conceal = 'X' }) + api.nvim_buf_set_extmark(0, ns, 2, 0, { end_col = 1, conceal = '>' }) end) test_mouse_click_conceal() end) end) it('getmousepos() works correctly', function() - local winwidth = meths.nvim_get_option_value('winwidth', {}) + local winwidth = api.nvim_get_option_value('winwidth', {}) -- Set winwidth=1 so that window sizes don't change. - meths.nvim_set_option_value('winwidth', 1, {}) + api.nvim_set_option_value('winwidth', 1, {}) command('tabedit') - local tabpage = meths.nvim_get_current_tabpage() + local tabpage = api.nvim_get_current_tabpage() insert('hello') command('vsplit') local opts = { @@ -1651,19 +1651,19 @@ describe('ui/mouse/input', function() border = 'single', focusable = 1, } - local float = meths.nvim_open_win(meths.nvim_get_current_buf(), false, opts) + local float = api.nvim_open_win(api.nvim_get_current_buf(), false, opts) command('redraw') - local lines = meths.nvim_get_option_value('lines', {}) - local columns = meths.nvim_get_option_value('columns', {}) + local lines = api.nvim_get_option_value('lines', {}) + local columns = api.nvim_get_option_value('columns', {}) -- Test that screenrow and screencol are set properly for all positions. for row = 0, lines - 1 do for col = 0, columns - 1 do -- Skip the X button that would close the tab. if row ~= 0 or col ~= columns - 1 then - meths.nvim_input_mouse('left', 'press', '', 0, row, col) - meths.nvim_set_current_tabpage(tabpage) - local mousepos = funcs.getmousepos() + api.nvim_input_mouse('left', 'press', '', 0, row, col) + api.nvim_set_current_tabpage(tabpage) + local mousepos = fn.getmousepos() eq(row + 1, mousepos.screenrow) eq(col + 1, mousepos.screencol) -- All other values should be 0 when clicking on the command line. @@ -1686,8 +1686,8 @@ describe('ui/mouse/input', function() for win_col = 0, opts.width + 1 do local row = win_row + opts.row local col = win_col + opts.col - meths.nvim_input_mouse('left', 'press', '', 0, row, col) - local mousepos = funcs.getmousepos() + api.nvim_input_mouse('left', 'press', '', 0, row, col) + local mousepos = fn.getmousepos() eq(float.id, mousepos.winid) eq(win_row + 1, mousepos.winrow) eq(win_col + 1, mousepos.wincol) @@ -1702,8 +1702,8 @@ describe('ui/mouse/input', function() then -- Because of border, win_row and win_col don't need to be -- incremented by 1. - line = math.min(win_row, funcs.line('$')) - column = math.min(win_col, #funcs.getline(line) + 1) + line = math.min(win_row, fn.line('$')) + column = math.min(win_col, #fn.getline(line) + 1) coladd = win_col - column end eq(line, mousepos.line) @@ -1715,19 +1715,19 @@ describe('ui/mouse/input', function() -- Test that mouse position values are properly set for the floating -- window, after removing the border. opts.border = 'none' - meths.nvim_win_set_config(float, opts) + api.nvim_win_set_config(float, opts) command('redraw') for win_row = 0, opts.height - 1 do for win_col = 0, opts.width - 1 do local row = win_row + opts.row local col = win_col + opts.col - meths.nvim_input_mouse('left', 'press', '', 0, row, col) - local mousepos = funcs.getmousepos() + api.nvim_input_mouse('left', 'press', '', 0, row, col) + local mousepos = fn.getmousepos() eq(float.id, mousepos.winid) eq(win_row + 1, mousepos.winrow) eq(win_col + 1, mousepos.wincol) - local line = math.min(win_row + 1, funcs.line('$')) - local column = math.min(win_col + 1, #funcs.getline(line) + 1) + local line = math.min(win_row + 1, fn.line('$')) + local column = math.min(win_col + 1, #fn.getline(line) + 1) local coladd = win_col + 1 - column eq(line, mousepos.line) eq(column, mousepos.column) @@ -1740,20 +1740,20 @@ describe('ui/mouse/input', function() -- that getmousepos() does not consider unfocusable floats. (see discussion -- in PR #14937 for details). opts.focusable = false - meths.nvim_win_set_config(float, opts) + api.nvim_win_set_config(float, opts) command('redraw') for nr = 1, 2 do - for win_row = 0, funcs.winheight(nr) - 1 do - for win_col = 0, funcs.winwidth(nr) - 1 do - local row = win_row + funcs.win_screenpos(nr)[1] - 1 - local col = win_col + funcs.win_screenpos(nr)[2] - 1 - meths.nvim_input_mouse('left', 'press', '', 0, row, col) - local mousepos = funcs.getmousepos() - eq(funcs.win_getid(nr), mousepos.winid) + for win_row = 0, fn.winheight(nr) - 1 do + for win_col = 0, fn.winwidth(nr) - 1 do + local row = win_row + fn.win_screenpos(nr)[1] - 1 + local col = win_col + fn.win_screenpos(nr)[2] - 1 + api.nvim_input_mouse('left', 'press', '', 0, row, col) + local mousepos = fn.getmousepos() + eq(fn.win_getid(nr), mousepos.winid) eq(win_row + 1, mousepos.winrow) eq(win_col + 1, mousepos.wincol) - local line = math.min(win_row + 1, funcs.line('$')) - local column = math.min(win_col + 1, #funcs.getline(line) + 1) + local line = math.min(win_row + 1, fn.line('$')) + local column = math.min(win_col + 1, #fn.getline(line) + 1) local coladd = win_col + 1 - column eq(line, mousepos.line) eq(column, mousepos.column) @@ -1764,34 +1764,34 @@ describe('ui/mouse/input', function() -- Restore state and release mouse. command('tabclose!') - meths.nvim_set_option_value('winwidth', winwidth, {}) - meths.nvim_input_mouse('left', 'release', '', 0, 0, 0) + api.nvim_set_option_value('winwidth', winwidth, {}) + api.nvim_input_mouse('left', 'release', '', 0, 0, 0) end) it('scroll keys are not translated into multiclicks and can be mapped #6211 #6989', function() - meths.nvim_set_var('mouse_up', 0) - meths.nvim_set_var('mouse_up2', 0) + api.nvim_set_var('mouse_up', 0) + api.nvim_set_var('mouse_up2', 0) command('nnoremap <ScrollWheelUp> <Cmd>let g:mouse_up += 1<CR>') command('nnoremap <2-ScrollWheelUp> <Cmd>let g:mouse_up2 += 1<CR>') feed('<ScrollWheelUp><0,0>') feed('<ScrollWheelUp><0,0>') - meths.nvim_input_mouse('wheel', 'up', '', 0, 0, 0) - meths.nvim_input_mouse('wheel', 'up', '', 0, 0, 0) - eq(4, meths.nvim_get_var('mouse_up')) - eq(0, meths.nvim_get_var('mouse_up2')) + api.nvim_input_mouse('wheel', 'up', '', 0, 0, 0) + api.nvim_input_mouse('wheel', 'up', '', 0, 0, 0) + eq(4, api.nvim_get_var('mouse_up')) + eq(0, api.nvim_get_var('mouse_up2')) end) it('<MouseMove> is not translated into multiclicks and can be mapped', function() - meths.nvim_set_var('mouse_move', 0) - meths.nvim_set_var('mouse_move2', 0) + api.nvim_set_var('mouse_move', 0) + api.nvim_set_var('mouse_move2', 0) command('nnoremap <MouseMove> <Cmd>let g:mouse_move += 1<CR>') command('nnoremap <2-MouseMove> <Cmd>let g:mouse_move2 += 1<CR>') feed('<MouseMove><0,0>') feed('<MouseMove><0,0>') - meths.nvim_input_mouse('move', '', '', 0, 0, 0) - meths.nvim_input_mouse('move', '', '', 0, 0, 0) - eq(4, meths.nvim_get_var('mouse_move')) - eq(0, meths.nvim_get_var('mouse_move2')) + api.nvim_input_mouse('move', '', '', 0, 0, 0) + api.nvim_input_mouse('move', '', '', 0, 0, 0) + eq(4, api.nvim_get_var('mouse_move')) + eq(0, api.nvim_get_var('mouse_move2')) end) it('feeding <MouseMove> in Normal mode does not use uninitialized memory #19480', function() @@ -1818,127 +1818,127 @@ describe('ui/mouse/input', function() vmenu PopUp.baz y:<C-U>let g:menustr = 'baz'<CR> ]]) - meths.nvim_win_set_cursor(0, { 1, 0 }) - meths.nvim_input_mouse('right', 'press', '', 0, 0, 4) - meths.nvim_input_mouse('right', 'release', '', 0, 0, 4) + api.nvim_win_set_cursor(0, { 1, 0 }) + api.nvim_input_mouse('right', 'press', '', 0, 0, 4) + api.nvim_input_mouse('right', 'release', '', 0, 0, 4) feed('<Down><Down><CR>') - eq('bar', meths.nvim_get_var('menustr')) - eq({ 1, 4 }, meths.nvim_win_get_cursor(0)) + eq('bar', api.nvim_get_var('menustr')) + eq({ 1, 4 }, api.nvim_win_get_cursor(0)) -- Test for right click in visual mode inside the selection - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 1, 9 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 1, 9 }) feed('vee') - meths.nvim_input_mouse('right', 'press', '', 0, 0, 11) - meths.nvim_input_mouse('right', 'release', '', 0, 0, 11) + api.nvim_input_mouse('right', 'press', '', 0, 0, 11) + api.nvim_input_mouse('right', 'release', '', 0, 0, 11) feed('<Down><CR>') - eq({ 1, 9 }, meths.nvim_win_get_cursor(0)) - eq('ran away', funcs.getreg('"')) + eq({ 1, 9 }, api.nvim_win_get_cursor(0)) + eq('ran away', fn.getreg('"')) -- Test for right click in visual mode right before the selection - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 1, 9 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 1, 9 }) feed('vee') - meths.nvim_input_mouse('right', 'press', '', 0, 0, 8) - meths.nvim_input_mouse('right', 'release', '', 0, 0, 8) + api.nvim_input_mouse('right', 'press', '', 0, 0, 8) + api.nvim_input_mouse('right', 'release', '', 0, 0, 8) feed('<Down><CR>') - eq({ 1, 8 }, meths.nvim_win_get_cursor(0)) - eq('', funcs.getreg('"')) + eq({ 1, 8 }, api.nvim_win_get_cursor(0)) + eq('', fn.getreg('"')) -- Test for right click in visual mode right after the selection - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 1, 9 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 1, 9 }) feed('vee') - meths.nvim_input_mouse('right', 'press', '', 0, 0, 17) - meths.nvim_input_mouse('right', 'release', '', 0, 0, 17) + api.nvim_input_mouse('right', 'press', '', 0, 0, 17) + api.nvim_input_mouse('right', 'release', '', 0, 0, 17) feed('<Down><CR>') - eq({ 1, 17 }, meths.nvim_win_get_cursor(0)) - eq('', funcs.getreg('"')) + eq({ 1, 17 }, api.nvim_win_get_cursor(0)) + eq('', fn.getreg('"')) -- Test for right click in block-wise visual mode inside the selection - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 1, 15 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 1, 15 }) feed('<C-V>j3l') - meths.nvim_input_mouse('right', 'press', '', 0, 1, 16) - meths.nvim_input_mouse('right', 'release', '', 0, 1, 16) + api.nvim_input_mouse('right', 'press', '', 0, 1, 16) + api.nvim_input_mouse('right', 'release', '', 0, 1, 16) feed('<Down><CR>') - eq({ 1, 15 }, meths.nvim_win_get_cursor(0)) - eq('\0224', funcs.getregtype('"')) + eq({ 1, 15 }, api.nvim_win_get_cursor(0)) + eq('\0224', fn.getregtype('"')) -- Test for right click in block-wise visual mode outside the selection - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 1, 15 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 1, 15 }) feed('<C-V>j3l') - meths.nvim_input_mouse('right', 'press', '', 0, 1, 1) - meths.nvim_input_mouse('right', 'release', '', 0, 1, 1) + api.nvim_input_mouse('right', 'press', '', 0, 1, 1) + api.nvim_input_mouse('right', 'release', '', 0, 1, 1) feed('<Down><CR>') - eq({ 2, 1 }, meths.nvim_win_get_cursor(0)) - eq('v', funcs.getregtype('"')) - eq('', funcs.getreg('"')) + eq({ 2, 1 }, api.nvim_win_get_cursor(0)) + eq('v', fn.getregtype('"')) + eq('', fn.getreg('"')) -- Test for right click in line-wise visual mode inside the selection - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 1, 15 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 1, 15 }) feed('V') - meths.nvim_input_mouse('right', 'press', '', 0, 0, 9) - meths.nvim_input_mouse('right', 'release', '', 0, 0, 9) + api.nvim_input_mouse('right', 'press', '', 0, 0, 9) + api.nvim_input_mouse('right', 'release', '', 0, 0, 9) feed('<Down><CR>') - eq({ 1, 0 }, meths.nvim_win_get_cursor(0)) -- After yanking, the cursor goes to 1,1 - eq('V', funcs.getregtype('"')) - eq(1, #funcs.getreg('"', 1, true)) + eq({ 1, 0 }, api.nvim_win_get_cursor(0)) -- After yanking, the cursor goes to 1,1 + eq('V', fn.getregtype('"')) + eq(1, #fn.getreg('"', 1, true)) -- Test for right click in multi-line line-wise visual mode inside the selection - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 1, 15 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 1, 15 }) feed('Vj') - meths.nvim_input_mouse('right', 'press', '', 0, 1, 19) - meths.nvim_input_mouse('right', 'release', '', 0, 1, 19) + api.nvim_input_mouse('right', 'press', '', 0, 1, 19) + api.nvim_input_mouse('right', 'release', '', 0, 1, 19) feed('<Down><CR>') - eq({ 1, 0 }, meths.nvim_win_get_cursor(0)) -- After yanking, the cursor goes to 1,1 - eq('V', funcs.getregtype('"')) - eq(2, #funcs.getreg('"', 1, true)) + eq({ 1, 0 }, api.nvim_win_get_cursor(0)) -- After yanking, the cursor goes to 1,1 + eq('V', fn.getregtype('"')) + eq(2, #fn.getreg('"', 1, true)) -- Test for right click in line-wise visual mode outside the selection - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 1, 15 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 1, 15 }) feed('V') - meths.nvim_input_mouse('right', 'press', '', 0, 1, 9) - meths.nvim_input_mouse('right', 'release', '', 0, 1, 9) + api.nvim_input_mouse('right', 'press', '', 0, 1, 9) + api.nvim_input_mouse('right', 'release', '', 0, 1, 9) feed('<Down><CR>') - eq({ 2, 9 }, meths.nvim_win_get_cursor(0)) - eq('', funcs.getreg('"')) + eq({ 2, 9 }, api.nvim_win_get_cursor(0)) + eq('', fn.getreg('"')) -- Try clicking outside the window - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 2, 1 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 2, 1 }) feed('vee') - meths.nvim_input_mouse('right', 'press', '', 0, 6, 1) - meths.nvim_input_mouse('right', 'release', '', 0, 6, 1) + api.nvim_input_mouse('right', 'press', '', 0, 6, 1) + api.nvim_input_mouse('right', 'release', '', 0, 6, 1) feed('<Down><CR>') - eq(2, funcs.winnr()) - eq('', funcs.getreg('"')) + eq(2, fn.winnr()) + eq('', fn.getreg('"')) -- Test for right click in visual mode inside the selection with vertical splits command('wincmd t') command('rightbelow vsplit') - funcs.setreg('"', '') - meths.nvim_win_set_cursor(0, { 1, 9 }) + fn.setreg('"', '') + api.nvim_win_set_cursor(0, { 1, 9 }) feed('vee') - meths.nvim_input_mouse('right', 'press', '', 0, 0, 52) - meths.nvim_input_mouse('right', 'release', '', 0, 0, 52) + api.nvim_input_mouse('right', 'press', '', 0, 0, 52) + api.nvim_input_mouse('right', 'release', '', 0, 0, 52) feed('<Down><CR>') - eq({ 1, 9 }, meths.nvim_win_get_cursor(0)) - eq('ran away', funcs.getreg('"')) + eq({ 1, 9 }, api.nvim_win_get_cursor(0)) + eq('ran away', fn.getreg('"')) -- Test for right click inside visual selection at bottom of window with winbar command('setlocal winbar=WINBAR') feed('2yyP') - funcs.setreg('"', '') + fn.setreg('"', '') feed('G$vbb') - meths.nvim_input_mouse('right', 'press', '', 0, 4, 61) - meths.nvim_input_mouse('right', 'release', '', 0, 4, 61) + api.nvim_input_mouse('right', 'press', '', 0, 4, 61) + api.nvim_input_mouse('right', 'release', '', 0, 4, 61) feed('<Down><CR>') - eq({ 4, 20 }, meths.nvim_win_get_cursor(0)) - eq('the moon', funcs.getreg('"')) + eq({ 4, 20 }, api.nvim_win_get_cursor(0)) + eq('the moon', fn.getreg('"')) end) end) diff --git a/test/functional/ui/multibyte_spec.lua b/test/functional/ui/multibyte_spec.lua index 72bb0b0174..d38bc27a51 100644 --- a/test/functional/ui/multibyte_spec.lua +++ b/test/functional/ui/multibyte_spec.lua @@ -5,8 +5,8 @@ local command = helpers.command local feed = helpers.feed local feed_command = helpers.feed_command local insert = helpers.insert -local funcs = helpers.funcs -local meths = helpers.meths +local fn = helpers.fn +local api = helpers.api local split = vim.split local dedent = helpers.dedent @@ -85,7 +85,7 @@ describe('multibyte rendering', function() ]]) -- check double-with char is temporarily hidden when overlapped - funcs.complete(4, { 'xx', 'yy' }) + fn.complete(4, { 'xx', 'yy' }) screen:expect([[ ab xx^ | - {2: xx } | @@ -118,7 +118,7 @@ describe('multibyte rendering', function() it('works with a lot of unicode (zalgo) text', function() screen:try_resize(65, 10) - meths.nvim_buf_set_lines( + api.nvim_buf_set_lines( 0, 0, -1, @@ -156,7 +156,7 @@ describe('multibyte rendering', function() -- nvim will reset the zalgo text^W^W glyph cache if it gets too full. -- this should be exceedingly rare, but fake it to make sure it works - meths.nvim__invalidate_glyph_cache() + api.nvim__invalidate_glyph_cache() screen:expect { grid = [[ ^L̓̉̑̒̌̚ơ̗̌̒̄̀ŕ̈̈̎̐̕è̇̅̄̄̐m̖̟̟̅̄̚ ̛̓̑̆̇̍i̗̟̞̜̅̐p̗̞̜̉̆̕s̟̜̘̍̑̏ū̟̞̎̃̉ḿ̘̙́́̐ ̖̍̌̇̉̚d̞̄̃̒̉̎ò́̌̌̂̐l̞̀̄̆̌̚ȯ̖̞̋̀̐r̓̇̌̃̃̚ ̗̘̀̏̍́s̜̀̎̎̑̕i̟̗̐̄̄̚t̝̎̆̓̐̒ ̘̇̔̓̊̚ȃ̛̟̗̏̅m̜̟̙̞̈̓é̘̞̟̔̆t̝̂̂̈̑̔,̜̜̖̅̄̍ ̛̗̊̓̆̚c̟̍̆̍̈̔ȯ̖̖̝̑̀n̜̟̎̊̃̚s̟̏̇̎̒̚e̙̐̈̓̌̚c̙̍̈̏̅̕ť̇̄̇̆̓e̛̓̌̈̓̈t̟̍̀̉̆̅u̝̞̎̂̄̚r̘̀̅̈̅̐ ̝̞̓́̇̉ã̏̀̆̅̕d̛̆̐̉̆̋ȉ̞̟̍̃̚p̛̜̊̍̂̓ȋ̏̅̃̋̚ṥ̛̏̃̕č̛̞̝̀̂í̗̘̌́̎n̔̎́̒̂̕ǧ̗̜̋̇̂ ̛̜̔̄̎̃ê̛̔̆̇̕l̘̝̏̐̊̏ĩ̛̍̏̏̄t̟̐́̀̐̎,̙̘̍̆̉̐ ̋̂̏̄̌̅s̙̓̌̈́̇e̛̗̋̒̎̏d̜̗̊̍̊̚ | @@ -227,7 +227,7 @@ describe('multibyte rendering', function() -- If we would increase the schar_t size, say from 32 to 64 bytes, we need to extend the -- test text with even more zalgo energy to still touch this edge case. - meths.nvim_buf_set_lines(0, 0, -1, true, { 'سلام့̀́̂̃̄̅̆̇̈̉̊̋̌' }) + api.nvim_buf_set_lines(0, 0, -1, true, { 'سلام့̀́̂̃̄̅̆̇̈̉̊̋̌' }) command('set noarabicshape') screen:expect { diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua index 600b08744f..c77363e584 100644 --- a/test/functional/ui/multigrid_spec.lua +++ b/test/functional/ui/multigrid_spec.lua @@ -3,9 +3,9 @@ local Screen = require('test.functional.ui.screen') local clear = helpers.clear local feed, command, insert = helpers.feed, helpers.command, helpers.insert local eq = helpers.eq -local funcs = helpers.funcs -local meths = helpers.meths -local curwin = helpers.meths.nvim_get_current_win +local fn = helpers.fn +local api = helpers.api +local curwin = helpers.api.nvim_get_current_win local poke_eventloop = helpers.poke_eventloop @@ -454,17 +454,17 @@ describe('ext_multigrid', function() end) it('winwidth() winheight() getwininfo() return inner width and height #19743', function() - eq(60, funcs.winwidth(0)) - eq(20, funcs.winheight(0)) - local win_info = funcs.getwininfo(curwin().id)[1] + eq(60, fn.winwidth(0)) + eq(20, fn.winheight(0)) + local win_info = fn.getwininfo(curwin().id)[1] eq(60, win_info.width) eq(20, win_info.height) end) it("'scroll' option works properly", function() - eq(10, meths.nvim_get_option_value('scroll', { win = 0 })) - meths.nvim_set_option_value('scroll', 15, { win = 0 }) - eq(15, meths.nvim_get_option_value('scroll', { win = 0 })) + eq(10, api.nvim_get_option_value('scroll', { win = 0 })) + api.nvim_set_option_value('scroll', 15, { win = 0 }) + eq(15, api.nvim_get_option_value('scroll', { win = 0 })) end) it('gets written till grid width', function() @@ -592,8 +592,8 @@ describe('ext_multigrid', function() ## grid 3 | ]]} - local float_buf = meths.nvim_create_buf(false, false) - meths.nvim_open_win(float_buf, false, { + local float_buf = api.nvim_create_buf(false, false) + api.nvim_open_win(float_buf, false, { relative = 'win', win = curwin(), bufpos = {0, 1018}, @@ -984,7 +984,7 @@ describe('ext_multigrid', function() | ]]} - meths.nvim_input_mouse('left', 'press', '', 2, 0, 5) + api.nvim_input_mouse('left', 'press', '', 2, 0, 5) screen:expect{grid=[[ ## grid 1 [2:-----------------------------------------------------]|*12 @@ -1020,7 +1020,7 @@ describe('ext_multigrid', function() {1:~ }|*4 ]]} - meths.nvim_input_mouse('left', 'press', '', 2, 1, 6) + api.nvim_input_mouse('left', 'press', '', 2, 1, 6) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*6 @@ -1040,7 +1040,7 @@ describe('ext_multigrid', function() {1:~ }|*4 ]]} - meths.nvim_input_mouse('left', 'press', '', 4, 1, 4) + api.nvim_input_mouse('left', 'press', '', 4, 1, 4) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*6 @@ -1079,7 +1079,7 @@ describe('ext_multigrid', function() {1:~ }| ]]} - meths.nvim_input_mouse('left', 'press', '', 4, 0, 64) + api.nvim_input_mouse('left', 'press', '', 4, 0, 64) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*6 @@ -1099,12 +1099,12 @@ describe('ext_multigrid', function() ]]} -- XXX: mouse_check_grid() doesn't work properly when clicking on grid 1 - meths.nvim_input_mouse('left', 'press', '', 1, 6, 20) + api.nvim_input_mouse('left', 'press', '', 1, 6, 20) -- TODO(bfredl): "batching" input_mouse is formally not supported yet. -- Normally it should work fine in async context when nvim is not blocked, -- but add a poke_eventloop be sure. poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 1, 4, 20) + api.nvim_input_mouse('left', 'drag', '', 1, 4, 20) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -1146,9 +1146,9 @@ describe('ext_multigrid', function() {1:~ }|*5 ]]} - meths.nvim_input_mouse('left', 'press', '', 1, 8, 26) + api.nvim_input_mouse('left', 'press', '', 1, 8, 26) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 1, 6, 30) + api.nvim_input_mouse('left', 'drag', '', 1, 6, 30) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -1173,8 +1173,8 @@ describe('ext_multigrid', function() command('aunmenu PopUp | vmenu PopUp.Copy y') - funcs.setreg('"', '') - meths.nvim_input_mouse('left', 'press', '2', 2, 1, 6) + fn.setreg('"', '') + api.nvim_input_mouse('left', 'press', '2', 2, 1, 6) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -1196,8 +1196,8 @@ describe('ext_multigrid', function() to be {20:clicked} | {1:~ }|*5 ]]} - meths.nvim_input_mouse('right', 'press', '', 2, 1, 6) - meths.nvim_input_mouse('right', 'release', '', 2, 1, 6) + api.nvim_input_mouse('right', 'press', '', 2, 1, 6) + api.nvim_input_mouse('right', 'release', '', 2, 1, 6) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -1245,10 +1245,10 @@ describe('ext_multigrid', function() to be clicked | {1:~ }|*5 ]]} - eq('clicked', funcs.getreg('"')) + eq('clicked', fn.getreg('"')) - funcs.setreg('"', '') - meths.nvim_input_mouse('left', 'press', '2', 4, 0, 64) + fn.setreg('"', '') + api.nvim_input_mouse('left', 'press', '2', 4, 0, 64) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -1270,8 +1270,8 @@ describe('ext_multigrid', function() to be clicked | {1:~ }|*5 ]]} - meths.nvim_input_mouse('right', 'press', '', 4, 0, 64) - meths.nvim_input_mouse('right', 'release', '', 4, 0, 64) + api.nvim_input_mouse('right', 'press', '', 4, 0, 64) + api.nvim_input_mouse('right', 'release', '', 4, 0, 64) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -1319,7 +1319,7 @@ describe('ext_multigrid', function() to be clicked | {1:~ }|*5 ]]} - eq('eiusmo', funcs.getreg('"')) + eq('eiusmo', fn.getreg('"')) command('wincmd J') screen:try_resize_grid(4, 7, 10) @@ -1353,8 +1353,8 @@ describe('ext_multigrid', function() {1:~ }|*3 ]]} - funcs.setreg('"', '') - meths.nvim_input_mouse('left', 'press', '2', 4, 9, 1) + fn.setreg('"', '') + api.nvim_input_mouse('left', 'press', '2', 4, 9, 1) screen:expect{grid=[[ ## grid 1 [5:------------------------------]│[2:----------------------]|*5 @@ -1384,8 +1384,8 @@ describe('ext_multigrid', function() to be clicked | {1:~ }|*3 ]]} - meths.nvim_input_mouse('right', 'press', '', 4, 9, 1) - meths.nvim_input_mouse('right', 'release', '', 4, 9, 1) + api.nvim_input_mouse('right', 'press', '', 4, 9, 1) + api.nvim_input_mouse('right', 'release', '', 4, 9, 1) screen:expect{grid=[[ ## grid 1 [5:------------------------------]│[2:----------------------]|*5 @@ -1449,7 +1449,7 @@ describe('ext_multigrid', function() to be clicked | {1:~ }|*3 ]]} - eq('eiusmo', funcs.getreg('"')) + eq('eiusmo', fn.getreg('"')) screen:try_resize_grid(4, 7, 11) screen:expect{grid=[[ @@ -1483,8 +1483,8 @@ describe('ext_multigrid', function() {1:~ }|*3 ]]} - funcs.setreg('"', '') - meths.nvim_input_mouse('left', 'press', '2', 4, 9, 1) + fn.setreg('"', '') + api.nvim_input_mouse('left', 'press', '2', 4, 9, 1) screen:expect{grid=[[ ## grid 1 [5:------------------------------]│[2:----------------------]|*5 @@ -1515,8 +1515,8 @@ describe('ext_multigrid', function() to be clicked | {1:~ }|*3 ]]} - meths.nvim_input_mouse('right', 'press', '', 4, 9, 1) - meths.nvim_input_mouse('right', 'release', '', 4, 9, 1) + api.nvim_input_mouse('right', 'press', '', 4, 9, 1) + api.nvim_input_mouse('right', 'release', '', 4, 9, 1) screen:expect{grid=[[ ## grid 1 [5:------------------------------]│[2:----------------------]|*5 @@ -1582,7 +1582,7 @@ describe('ext_multigrid', function() to be clicked | {1:~ }|*3 ]]} - eq('eiusmo', funcs.getreg('"')) + eq('eiusmo', fn.getreg('"')) end) it('supports mouse drag with mouse=a', function() @@ -1593,9 +1593,9 @@ describe('ext_multigrid', function() command('enew') feed('ifoo\nbar<esc>') - meths.nvim_input_mouse('left', 'press', '', 5, 0, 0) + api.nvim_input_mouse('left', 'press', '', 5, 0, 0) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 5, 1, 2) + api.nvim_input_mouse('left', 'drag', '', 5, 1, 2) screen:expect{grid=[[ ## grid 1 @@ -1752,7 +1752,7 @@ describe('ext_multigrid', function() }} -- handles non-current window - meths.nvim_win_set_cursor(1000, {1, 10}) + api.nvim_win_set_cursor(1000, {1, 10}) screen:expect{grid=[[ ## grid 1 [4:------------------------------------------------]|*3 @@ -2257,9 +2257,9 @@ describe('ext_multigrid', function() [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11, sum_scroll_delta = 5}, }} - meths.nvim_input_mouse('left', 'press', '', 1,5, 1) + api.nvim_input_mouse('left', 'press', '', 1,5, 1) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 1, 6, 1) + api.nvim_input_mouse('left', 'drag', '', 1, 6, 1) screen:expect{grid=[[ ## grid 1 @@ -2357,7 +2357,7 @@ describe('ext_multigrid', function() end) it('with winbar dragging statusline with mouse works correctly', function() - meths.nvim_set_option_value('winbar', 'Set Up The Bars', {}) + api.nvim_set_option_value('winbar', 'Set Up The Bars', {}) command('split') screen:expect([[ ## grid 1 @@ -2378,9 +2378,9 @@ describe('ext_multigrid', function() {1:~ }|*4 ]]) - meths.nvim_input_mouse('left', 'press', '', 1, 6, 20) + api.nvim_input_mouse('left', 'press', '', 1, 6, 20) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 1, 7, 20) + api.nvim_input_mouse('left', 'drag', '', 1, 7, 20) screen:expect([[ ## grid 1 [4:-----------------------------------------------------]|*7 @@ -2400,7 +2400,7 @@ describe('ext_multigrid', function() {1:~ }|*5 ]]) - meths.nvim_input_mouse('left', 'drag', '', 1, 4, 20) + api.nvim_input_mouse('left', 'drag', '', 1, 4, 20) screen:expect([[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -2420,9 +2420,9 @@ describe('ext_multigrid', function() {1:~ }|*2 ]]) - meths.nvim_input_mouse('left', 'press', '', 1, 12, 10) + api.nvim_input_mouse('left', 'press', '', 1, 12, 10) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 1, 10, 10) + api.nvim_input_mouse('left', 'drag', '', 1, 10, 10) screen:expect([[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -2441,9 +2441,9 @@ describe('ext_multigrid', function() ^ | {1:~ }|*2 ]]) - eq(3, meths.nvim_get_option_value('cmdheight', {})) + eq(3, api.nvim_get_option_value('cmdheight', {})) - meths.nvim_input_mouse('left', 'drag', '', 1, 12, 10) + api.nvim_input_mouse('left', 'drag', '', 1, 12, 10) screen:expect([[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -2462,6 +2462,6 @@ describe('ext_multigrid', function() ^ | {1:~ }|*2 ]]) - eq(1, meths.nvim_get_option_value('cmdheight', {})) + eq(1, api.nvim_get_option_value('cmdheight', {})) end) end) diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index b4cfe39bc3..941b8b69bf 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -4,10 +4,10 @@ local assert_alive = helpers.assert_alive local clear, feed = helpers.clear, helpers.feed local source = helpers.source local insert = helpers.insert -local meths = helpers.meths +local api = helpers.api local async_meths = helpers.async_meths local command = helpers.command -local funcs = helpers.funcs +local fn = helpers.fn local eq = helpers.eq local pcall_err = helpers.pcall_err local exec_lua = helpers.exec_lua @@ -117,7 +117,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.nvim_select_popupmenu_item(1, false, false, {}) + api.nvim_select_popupmenu_item(1, false, false, {}) screen:expect { grid = [[ | @@ -132,7 +132,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.nvim_select_popupmenu_item(2, true, false, {}) + api.nvim_select_popupmenu_item(2, true, false, {}) screen:expect { grid = [[ | @@ -147,7 +147,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.nvim_select_popupmenu_item(0, true, true, {}) + api.nvim_select_popupmenu_item(0, true, true, {}) screen:expect([[ | foo^ | @@ -170,7 +170,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.nvim_select_popupmenu_item(-1, false, false, {}) + api.nvim_select_popupmenu_item(-1, false, false, {}) screen:expect { grid = [[ | @@ -185,7 +185,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.nvim_select_popupmenu_item(1, true, false, {}) + api.nvim_select_popupmenu_item(1, true, false, {}) screen:expect { grid = [[ | @@ -200,7 +200,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.nvim_select_popupmenu_item(-1, true, false, {}) + api.nvim_select_popupmenu_item(-1, true, false, {}) screen:expect { grid = [[ | @@ -215,7 +215,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.nvim_select_popupmenu_item(0, true, false, {}) + api.nvim_select_popupmenu_item(0, true, false, {}) screen:expect { grid = [[ | @@ -230,7 +230,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.nvim_select_popupmenu_item(-1, true, true, {}) + api.nvim_select_popupmenu_item(-1, true, true, {}) screen:expect([[ | ^ | @@ -262,7 +262,7 @@ describe('ui/ext_popupmenu', function() }, }) - meths.nvim_select_popupmenu_item(-1, true, false, {}) + api.nvim_select_popupmenu_item(-1, true, false, {}) screen:expect({ grid = [[ |*2 @@ -276,7 +276,7 @@ describe('ui/ext_popupmenu', function() }, }) - meths.nvim_select_popupmenu_item(5, true, false, {}) + api.nvim_select_popupmenu_item(5, true, false, {}) screen:expect({ grid = [[ |*2 @@ -290,7 +290,7 @@ describe('ui/ext_popupmenu', function() }, }) - meths.nvim_select_popupmenu_item(-1, true, true, {}) + api.nvim_select_popupmenu_item(-1, true, true, {}) screen:expect({ grid = [[ |*2 @@ -313,7 +313,7 @@ describe('ui/ext_popupmenu', function() }, }) - meths.nvim_select_popupmenu_item(5, true, true, {}) + api.nvim_select_popupmenu_item(5, true, true, {}) screen:expect({ grid = [[ |*2 @@ -608,7 +608,7 @@ describe('ui/ext_popupmenu', function() } local pum_height = 6 feed('o<C-r>=TestCompleteMonth()<CR>') - meths.nvim_ui_pum_set_height(pum_height) + api.nvim_ui_pum_set_height(pum_height) feed('<PageDown>') -- pos becomes pum_height-2 because it is subtracting 2 to keep some -- context in ins_compl_key2count() @@ -628,14 +628,14 @@ describe('ui/ext_popupmenu', function() end) it('an error occurs if set 0 or less', function() - meths.nvim_ui_pum_set_height(1) - eq('Expected pum height > 0', pcall_err(meths.nvim_ui_pum_set_height, 0)) + api.nvim_ui_pum_set_height(1) + eq('Expected pum height > 0', pcall_err(api.nvim_ui_pum_set_height, 0)) end) it('an error occurs when ext_popupmenu is false', function() - meths.nvim_ui_pum_set_height(1) + api.nvim_ui_pum_set_height(1) screen:set_option('ext_popupmenu', false) - eq('It must support the ext_popupmenu option', pcall_err(meths.nvim_ui_pum_set_height, 1)) + eq('It must support the ext_popupmenu option', pcall_err(api.nvim_ui_pum_set_height, 1)) end) end) @@ -658,9 +658,9 @@ describe('ui/ext_popupmenu', function() } local pum_height = 6 feed('o<C-r>=TestCompleteMonth()<CR>') - meths.nvim_ui_pum_set_height(pum_height) + api.nvim_ui_pum_set_height(pum_height) -- set bounds w h r c - meths.nvim_ui_pum_set_bounds(10.5, 5.2, 6.3, 7.4) + api.nvim_ui_pum_set_bounds(10.5, 5.2, 6.3, 7.4) feed('<PageDown>') -- pos becomes pum_height-2 because it is subtracting 2 to keep some -- context in ins_compl_key2count() @@ -680,23 +680,23 @@ describe('ui/ext_popupmenu', function() end) it('no error occurs if row or col set less than 0', function() - meths.nvim_ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5) - meths.nvim_ui_pum_set_bounds(1.0, 1.0, -1.0, 0.0) - meths.nvim_ui_pum_set_bounds(1.0, 1.0, 0.0, -1.0) + api.nvim_ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5) + api.nvim_ui_pum_set_bounds(1.0, 1.0, -1.0, 0.0) + api.nvim_ui_pum_set_bounds(1.0, 1.0, 0.0, -1.0) end) it('an error occurs if width or height set 0 or less', function() - meths.nvim_ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5) - eq('Expected width > 0', pcall_err(meths.nvim_ui_pum_set_bounds, 0.0, 1.0, 1.0, 0.0)) - eq('Expected height > 0', pcall_err(meths.nvim_ui_pum_set_bounds, 1.0, -1.0, 1.0, 0.0)) + api.nvim_ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5) + eq('Expected width > 0', pcall_err(api.nvim_ui_pum_set_bounds, 0.0, 1.0, 1.0, 0.0)) + eq('Expected height > 0', pcall_err(api.nvim_ui_pum_set_bounds, 1.0, -1.0, 1.0, 0.0)) end) it('an error occurs when ext_popupmenu is false', function() - meths.nvim_ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5) + api.nvim_ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5) screen:set_option('ext_popupmenu', false) eq( 'UI must support the ext_popupmenu option', - pcall_err(meths.nvim_ui_pum_set_bounds, 1.0, 1.0, 0.0, 1.5) + pcall_err(api.nvim_ui_pum_set_bounds, 1.0, 1.0, 0.0, 1.5) ) end) end) @@ -768,7 +768,7 @@ describe('ui/ext_popupmenu', function() {1:~ }|*8 :sign ^ | ]]) - eq(0, funcs.wildmenumode()) + eq(0, fn.wildmenumode()) feed('<tab>') screen:expect { @@ -779,7 +779,7 @@ describe('ui/ext_popupmenu', function() ]], popupmenu = { items = wild_expected, pos = 0, anchor = { 1, 9, 6 } }, } - eq(1, funcs.wildmenumode()) + eq(1, fn.wildmenumode()) feed('<left>') screen:expect { @@ -820,7 +820,7 @@ describe('ui/ext_popupmenu', function() popupmenu = { items = wild_expected, pos = 5, anchor = { 1, 9, 6 } }, } feed('<esc>') - eq(0, funcs.wildmenumode()) + eq(0, fn.wildmenumode()) -- check positioning with multibyte char in pattern command('e långfile1') @@ -1055,7 +1055,7 @@ describe("builtin popupmenu 'pumblend'", function() {20:-- Keyword Local completion (^N^P) }{21:match 1 of 65} | ]]) - meths.nvim_input_mouse('wheel', 'down', '', 0, 9, 40) + api.nvim_input_mouse('wheel', 'down', '', 0, 9, 40) screen:expect([[ Lorem ipsum d{1:ol}or sit amet, consectetur | adipisicing elit, sed do eiusmod tempor | @@ -2014,7 +2014,7 @@ describe('builtin popupmenu', function() {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} | ]]) - meths.nvim_input_mouse('wheel', 'down', '', 0, 9, 40) + api.nvim_input_mouse('wheel', 'down', '', 0, 9, 40) screen:expect([[ Est ^ | L{n: sunt }{s: }sit amet, consectetur | @@ -2050,7 +2050,7 @@ describe('builtin popupmenu', function() {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} | ]]) - meths.nvim_input_mouse('wheel', 'up', '', 0, 9, 40) + api.nvim_input_mouse('wheel', 'up', '', 0, 9, 40) screen:expect([[ Est e^ | L{n: elit } sit amet, consectetur | @@ -2086,7 +2086,7 @@ describe('builtin popupmenu', function() {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} | ]]) - meths.nvim_input_mouse('wheel', 'down', '', 0, 9, 40) + api.nvim_input_mouse('wheel', 'down', '', 0, 9, 40) screen:expect([[ Est es^ | L{n: esse } sit amet, consectetur | @@ -2140,7 +2140,7 @@ describe('builtin popupmenu', function() {2:-- Keyword Local completion (^N^P) }{5:match 22 of 65} | ]]) - meths.nvim_input_mouse('wheel', 'down', '', 0, 9, 40) + api.nvim_input_mouse('wheel', 'down', '', 0, 9, 40) screen:expect([[ Est eu^ | L{n: elit } sit amet, consectetur | @@ -2158,10 +2158,7 @@ describe('builtin popupmenu', function() {2:-- Keyword Local completion (^N^P) }{5:match 22 of 65} | ]]) - funcs.complete( - 4, - { 'ea', 'eeeeeeeeeeeeeeeeee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' } - ) + fn.complete(4, { 'ea', 'eeeeeeeeeeeeeeeeee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' }) screen:expect([[ Est eu^ | {s: ea }t amet, consectetur | @@ -2179,7 +2176,7 @@ describe('builtin popupmenu', function() {2:-- Keyword Local completion (^N^P) }{5:match 1 of 9} | ]]) - funcs.complete(4, { 'ea', 'eee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' }) + fn.complete(4, { 'ea', 'eee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' }) screen:expect([[ Est eu^ | {s: ea }r sit amet, consectetur | @@ -2215,7 +2212,7 @@ describe('builtin popupmenu', function() {2:-- INSERT --} | ]]) - funcs.complete(6, { 'foo', 'bar' }) + fn.complete(6, { 'foo', 'bar' }) screen:expect([[ Esteee^ | Lo{s: foo }sit amet, consectetur | @@ -2256,7 +2253,7 @@ describe('builtin popupmenu', function() feed('isome long prefix before the ') command('set completeopt+=noinsert,noselect') command('set linebreak') - funcs.complete(29, { 'word', 'choice', 'text', 'thing' }) + fn.complete(29, { 'word', 'choice', 'text', 'thing' }) screen:expect([[ some long prefix before the ^ | {1:~ }{n: word }| @@ -2360,7 +2357,7 @@ describe('builtin popupmenu', function() command('set completeopt+=noinsert,noselect') command('autocmd VimResized * redraw!') command('set linebreak') - funcs.complete(29, { 'word', 'choice', 'text', 'thing' }) + fn.complete(29, { 'word', 'choice', 'text', 'thing' }) screen:expect([[ some long prefix before the ^ | {1:~ }{n: word }| @@ -2395,7 +2392,7 @@ describe('builtin popupmenu', function() ]]) command('set completeopt+=noinsert,noselect') - funcs.complete(16, { 'word', 'choice', 'text', 'thing' }) + fn.complete(16, { 'word', 'choice', 'text', 'thing' }) screen:expect([[ ^ tfelthgir emos| {1: }{n: drow }{1: ~}| @@ -2458,7 +2455,7 @@ describe('builtin popupmenu', function() command('set completeopt+=noinsert,noselect') command('set pumheight=2') feed('isome rightleft ') - funcs.complete(16, { 'word', 'choice', 'text', 'thing' }) + fn.complete(16, { 'word', 'choice', 'text', 'thing' }) if multigrid then screen:expect { grid = [[ @@ -2493,7 +2490,7 @@ describe('builtin popupmenu', function() ]]) end feed('<C-E><CR>') - funcs.complete(1, { 'word', 'choice', 'text', 'thing' }) + fn.complete(1, { 'word', 'choice', 'text', 'thing' }) if multigrid then screen:expect { grid = [[ @@ -2603,7 +2600,7 @@ describe('builtin popupmenu', function() screen:try_resize(40, 8) feed('ixx<cr>') command('imap <f2> <cmd>echoerr "very"\\|echoerr "much"\\|echoerr "error"<cr>') - funcs.complete(1, { 'word', 'choice', 'text', 'thing' }) + fn.complete(1, { 'word', 'choice', 'text', 'thing' }) screen:expect([[ xx | word^ | @@ -2663,7 +2660,7 @@ describe('builtin popupmenu', function() {2:-- INSERT --} | ]]) - meths.nvim_input_mouse('wheel', 'down', '', 0, 6, 15) + api.nvim_input_mouse('wheel', 'down', '', 0, 6, 15) screen:expect { grid = [[ xx | @@ -2682,7 +2679,7 @@ describe('builtin popupmenu', function() it('with kind, menu and abbr attributes', function() screen:try_resize(40, 8) feed('ixx ') - funcs.complete(4, { + fn.complete(4, { { word = 'wordey', kind = 'x', menu = 'extrainfo' }, 'thing', { word = 'secret', abbr = 'sneaky', menu = 'bar' }, @@ -3317,7 +3314,7 @@ describe('builtin popupmenu', function() :sign un^ | ]], } - eq(0, funcs.wildmenumode()) + eq(0, fn.wildmenumode()) -- pressing <Tab> should display the wildmenu feed('<Tab>') @@ -3330,7 +3327,7 @@ describe('builtin popupmenu', function() :sign undefine^ | ]], } - eq(1, funcs.wildmenumode()) + eq(1, fn.wildmenumode()) -- pressing <Tab> second time should select the next entry in the menu feed('<Tab>') @@ -3347,7 +3344,7 @@ describe('builtin popupmenu', function() it('wildoptions=pum with a wrapped line in buffer vim-patch:8.2.4655', function() screen:try_resize(32, 10) - meths.nvim_buf_set_lines(0, 0, -1, true, { ('a'):rep(100) }) + api.nvim_buf_set_lines(0, 0, -1, true, { ('a'):rep(100) }) command('set wildoptions+=pum') feed('$') feed(':sign <Tab>') @@ -3461,7 +3458,7 @@ describe('builtin popupmenu', function() command('set completeopt+=noinsert,noselect') command('set linebreak') command('set pumheight=2') - funcs.complete(29, { 'word', 'choice', 'text', 'thing' }) + fn.complete(29, { 'word', 'choice', 'text', 'thing' }) if multigrid then screen:expect { grid = [[ @@ -3498,7 +3495,7 @@ describe('builtin popupmenu', function() command('set completeopt+=noinsert,noselect') command('set linebreak') command('set pumwidth=8') - funcs.complete(29, { 'word', 'choice', 'text', 'thing' }) + fn.complete(29, { 'word', 'choice', 'text', 'thing' }) if multigrid then screen:expect { grid = [[ @@ -3544,7 +3541,7 @@ describe('builtin popupmenu', function() command('set rightleft') command('call setline(1, repeat(" ", &columns - ' .. max_len .. '))') feed('$i') - funcs.complete(col - max_len, items) + fn.complete(col - max_len, items) feed('<c-y>') assert_alive() end) @@ -3553,7 +3550,7 @@ describe('builtin popupmenu', function() screen:try_resize(32, 8) command('set completeopt+=menuone,noselect') feed('i' .. string.rep(' ', 13)) - funcs.complete(14, { '哦哦哦哦哦哦哦哦哦哦' }) + fn.complete(14, { '哦哦哦哦哦哦哦哦哦哦' }) if multigrid then screen:expect({ grid = [[ @@ -3589,7 +3586,7 @@ describe('builtin popupmenu', function() for _ = 1, 8 do table.insert(items, { word = '哦哦哦哦哦哦哦哦哦哦', equal = 1, dup = 1 }) end - funcs.complete(13, items) + fn.complete(13, items) if multigrid then screen:expect({ grid = [[ @@ -3631,7 +3628,7 @@ describe('builtin popupmenu', function() ]]) if multigrid then - meths.nvim_input_mouse('right', 'press', '', 2, 0, 4) + api.nvim_input_mouse('right', 'press', '', 2, 0, 4) screen:expect({ grid = [[ ## grid 1 @@ -3739,10 +3736,10 @@ describe('builtin popupmenu', function() :let g:menustr = 'bar' | ]]) end - eq('bar', meths.nvim_get_var('menustr')) + eq('bar', api.nvim_get_var('menustr')) if multigrid then - meths.nvim_input_mouse('right', 'press', '', 2, 2, 20) + api.nvim_input_mouse('right', 'press', '', 2, 2, 20) screen:expect({ grid = [[ ## grid 1 @@ -3771,7 +3768,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.nvim_input_mouse('right', 'press', '', 2, 0, 18) + api.nvim_input_mouse('right', 'press', '', 2, 0, 18) screen:expect { grid = [[ ## grid 1 @@ -3803,7 +3800,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.nvim_input_mouse('right', 'press', '', 4, 1, 3) + api.nvim_input_mouse('right', 'press', '', 4, 1, 3) screen:expect({ grid = [[ ## grid 1 @@ -3832,7 +3829,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 2, 2) + api.nvim_input_mouse('left', 'press', '', 4, 2, 2) screen:expect({ grid = [[ ## grid 1 @@ -3853,10 +3850,10 @@ describe('builtin popupmenu', function() :let g:menustr = 'baz' | ]]) end - eq('baz', meths.nvim_get_var('menustr')) + eq('baz', api.nvim_get_var('menustr')) if multigrid then - meths.nvim_input_mouse('right', 'press', '', 2, 0, 4) + api.nvim_input_mouse('right', 'press', '', 2, 0, 4) screen:expect({ grid = [[ ## grid 1 @@ -3886,7 +3883,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.nvim_input_mouse('right', 'drag', '', 2, 3, 6) + api.nvim_input_mouse('right', 'drag', '', 2, 3, 6) screen:expect({ grid = [[ ## grid 1 @@ -3916,7 +3913,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.nvim_input_mouse('right', 'release', '', 2, 1, 6) + api.nvim_input_mouse('right', 'release', '', 2, 1, 6) screen:expect({ grid = [[ ## grid 1 @@ -3937,11 +3934,11 @@ describe('builtin popupmenu', function() :let g:menustr = 'foo' | ]]) end - eq('foo', meths.nvim_get_var('menustr')) + eq('foo', api.nvim_get_var('menustr')) eq(false, screen.options.mousemoveevent) if multigrid then - meths.nvim_input_mouse('right', 'press', '', 2, 0, 4) + api.nvim_input_mouse('right', 'press', '', 2, 0, 4) screen:expect({ grid = [[ ## grid 1 @@ -3972,7 +3969,7 @@ describe('builtin popupmenu', function() end eq(true, screen.options.mousemoveevent) if multigrid then - meths.nvim_input_mouse('move', '', '', 2, 3, 6) + api.nvim_input_mouse('move', '', '', 2, 3, 6) screen:expect({ grid = [[ ## grid 1 @@ -4003,7 +4000,7 @@ describe('builtin popupmenu', function() end eq(true, screen.options.mousemoveevent) if multigrid then - meths.nvim_input_mouse('left', 'press', '', 2, 2, 6) + api.nvim_input_mouse('left', 'press', '', 2, 2, 6) screen:expect({ grid = [[ ## grid 1 @@ -4025,11 +4022,11 @@ describe('builtin popupmenu', function() ]]) end eq(false, screen.options.mousemoveevent) - eq('bar', meths.nvim_get_var('menustr')) + eq('bar', api.nvim_get_var('menustr')) command('set laststatus=0 | botright split') if multigrid then - meths.nvim_input_mouse('right', 'press', '', 5, 1, 20) + api.nvim_input_mouse('right', 'press', '', 5, 1, 20) screen:expect({ grid = [[ ## grid 1 @@ -4064,7 +4061,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 2, 2) + api.nvim_input_mouse('left', 'press', '', 4, 2, 2) screen:expect({ grid = [[ ## grid 1 @@ -4093,11 +4090,11 @@ describe('builtin popupmenu', function() :let g:menustr = 'baz' | ]]) end - eq('baz', meths.nvim_get_var('menustr')) + eq('baz', api.nvim_get_var('menustr')) command('set winwidth=1 | rightbelow vsplit') if multigrid then - meths.nvim_input_mouse('right', 'press', '', 6, 1, 14) + api.nvim_input_mouse('right', 'press', '', 6, 1, 14) screen:expect({ grid = [[ ## grid 1 @@ -4135,7 +4132,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 0, 2) + api.nvim_input_mouse('left', 'press', '', 4, 0, 2) screen:expect({ grid = [[ ## grid 1 @@ -4167,11 +4164,11 @@ describe('builtin popupmenu', function() :let g:menustr = 'foo' | ]]) end - eq('foo', meths.nvim_get_var('menustr')) + eq('foo', api.nvim_get_var('menustr')) command('setlocal winbar=WINBAR') if multigrid then - meths.nvim_input_mouse('right', 'press', '', 6, 1, 14) + api.nvim_input_mouse('right', 'press', '', 6, 1, 14) screen:expect({ grid = [[ ## grid 1 @@ -4209,7 +4206,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.nvim_input_mouse('left', 'press', '', 4, 1, 2) + api.nvim_input_mouse('left', 'press', '', 4, 1, 2) screen:expect({ grid = [[ ## grid 1 @@ -4241,7 +4238,7 @@ describe('builtin popupmenu', function() :let g:menustr = 'bar' | ]]) end - eq('bar', meths.nvim_get_var('menustr')) + eq('bar', api.nvim_get_var('menustr')) end) if not multigrid then diff --git a/test/functional/ui/quickfix_spec.lua b/test/functional/ui/quickfix_spec.lua index f8475acb68..40f8ef353a 100644 --- a/test/functional/ui/quickfix_spec.lua +++ b/test/functional/ui/quickfix_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, meths = helpers.clear, helpers.feed, helpers.meths +local clear, feed, api = helpers.clear, helpers.feed, helpers.api local insert, command = helpers.insert, helpers.command describe('quickfix selection highlight', function() @@ -26,7 +26,7 @@ describe('quickfix selection highlight', function() [12] = { foreground = Screen.colors.Brown, background = Screen.colors.Fuchsia }, }) - meths.nvim_set_option_value('errorformat', '%m %l', {}) + api.nvim_set_option_value('errorformat', '%m %l', {}) command('syntax on') command('highlight Search guibg=Green') diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua index 3089690f0a..42e2b4d4b5 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -4,7 +4,7 @@ local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.cl local feed, command = helpers.feed, helpers.command local insert = helpers.insert local eq = helpers.eq -local funcs, meths = helpers.funcs, helpers.meths +local fn, api = helpers.fn, helpers.api describe('screen', function() local screen @@ -597,7 +597,7 @@ local function screen_tests(linegrid) command([[autocmd VimResized * redrawtabline]]) command([[autocmd VimResized * lua vim.api.nvim_echo({ { 'Hello' } }, false, {})]]) command([[autocmd VimResized * let g:echospace = v:echospace]]) - meths.nvim_set_option_value('showtabline', 2, {}) + api.nvim_set_option_value('showtabline', 2, {}) screen:expect([[ {2: + [No Name] }{3: }| resiz^e | @@ -611,7 +611,7 @@ local function screen_tests(linegrid) {0:~ }|*3 | ]]) - eq(29, meths.nvim_get_var('echospace')) + eq(29, api.nvim_get_var('echospace')) end) it('messages from the same Ex command as resize are visible #22225', function() @@ -779,33 +779,33 @@ it('CTRL-F or CTRL-B scrolls a page after UI attach/resize #20605', function() clear() local screen = Screen.new(100, 100) screen:attach() - eq(100, meths.nvim_get_option_value('lines', {})) - eq(99, meths.nvim_get_option_value('window', {})) - eq(99, meths.nvim_win_get_height(0)) + eq(100, api.nvim_get_option_value('lines', {})) + eq(99, api.nvim_get_option_value('window', {})) + eq(99, api.nvim_win_get_height(0)) feed('1000o<Esc>') - eq(903, funcs.line('w0')) + eq(903, fn.line('w0')) feed('<C-B>') - eq(806, funcs.line('w0')) + eq(806, fn.line('w0')) feed('<C-B>') - eq(709, funcs.line('w0')) + eq(709, fn.line('w0')) feed('<C-F>') - eq(806, funcs.line('w0')) + eq(806, fn.line('w0')) feed('<C-F>') - eq(903, funcs.line('w0')) + eq(903, fn.line('w0')) feed('G') screen:try_resize(50, 50) - eq(50, meths.nvim_get_option_value('lines', {})) - eq(49, meths.nvim_get_option_value('window', {})) - eq(49, meths.nvim_win_get_height(0)) - eq(953, funcs.line('w0')) + eq(50, api.nvim_get_option_value('lines', {})) + eq(49, api.nvim_get_option_value('window', {})) + eq(49, api.nvim_win_get_height(0)) + eq(953, fn.line('w0')) feed('<C-B>') - eq(906, funcs.line('w0')) + eq(906, fn.line('w0')) feed('<C-B>') - eq(859, funcs.line('w0')) + eq(859, fn.line('w0')) feed('<C-F>') - eq(906, funcs.line('w0')) + eq(906, fn.line('w0')) feed('<C-F>') - eq(953, funcs.line('w0')) + eq(953, fn.line('w0')) end) it("showcmd doesn't cause empty grid_line with redrawdebug=compositor #22593", function() diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 68596f27ad..f745cdb97b 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -5,7 +5,7 @@ local command = helpers.command local feed_command = helpers.feed_command local eq = helpers.eq local eval = helpers.eval -local funcs = helpers.funcs +local fn = helpers.fn local testprg = helpers.testprg describe('search highlighting', function() @@ -458,13 +458,13 @@ describe('search highlighting', function() command([[let @/ = 'i']]) -- moves to next match of previous search pattern, just like /<cr> feed('/<c-g><cr>') - eq({ 0, 1, 6, 0 }, funcs.getpos('.')) + eq({ 0, 1, 6, 0 }, fn.getpos('.')) -- moves to next match of previous search pattern, just like /<cr> feed('/<cr>') - eq({ 0, 1, 12, 0 }, funcs.getpos('.')) + eq({ 0, 1, 12, 0 }, fn.getpos('.')) -- moves to next match of previous search pattern, just like /<cr> feed('/<c-t><cr>') - eq({ 0, 2, 1, 0 }, funcs.getpos('.')) + eq({ 0, 2, 1, 0 }, fn.getpos('.')) -- 8.0.1304, test that C-g and C-t works with incsearch and empty pattern feed('<esc>/fi<CR>') diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index cade21a3e4..5e45c3113b 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, exec, meths = helpers.clear, helpers.feed, helpers.exec, helpers.meths +local clear, feed, exec, api = helpers.clear, helpers.feed, helpers.exec, helpers.api describe('Signs', function() local screen @@ -423,7 +423,7 @@ describe('Signs', function() {0:~ }|*7 | ]]) - meths.nvim_buf_set_extmark(0, meths.nvim_create_namespace('test'), 0, 0, { + api.nvim_buf_set_extmark(0, api.nvim_create_namespace('test'), 0, 0, { virt_lines = { { { 'VIRT LINES' } } }, virt_lines_above = true, }) @@ -468,7 +468,7 @@ describe('Signs', function() end) it('signcolumn width is updated when removing all signs after deleting lines', function() - meths.nvim_buf_set_lines(0, 0, 1, true, { 'a', 'b', 'c', 'd', 'e' }) + api.nvim_buf_set_lines(0, 0, 1, true, { 'a', 'b', 'c', 'd', 'e' }) exec('sign define piet text=>>') exec('sign place 10001 line=1 name=piet') exec('sign place 10002 line=5 name=piet') @@ -494,7 +494,7 @@ describe('Signs', function() end) it('signcolumn width is updated when removing all signs after inserting lines', function() - meths.nvim_buf_set_lines(0, 0, 1, true, { 'a', 'b', 'c', 'd', 'e' }) + api.nvim_buf_set_lines(0, 0, 1, true, { 'a', 'b', 'c', 'd', 'e' }) exec('sign define piet text=>>') exec('sign place 10001 line=1 name=piet') exec('sign place 10002 line=5 name=piet') diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua index f52ae29562..8b5644ee42 100644 --- a/test/functional/ui/spell_spec.lua +++ b/test/functional/ui/spell_spec.lua @@ -6,7 +6,7 @@ local clear = helpers.clear local exec = helpers.exec local feed = helpers.feed local insert = helpers.insert -local meths = helpers.meths +local api = helpers.api local is_os = helpers.is_os describe("'spell'", function() @@ -259,9 +259,9 @@ describe("'spell'", function() {6:search hit BOTTOM, continuing at TOP} | ]]) exec('echo ""') - local ns = meths.nvim_create_namespace('spell') + local ns = api.nvim_create_namespace('spell') -- extmark with spell=true enables spell - local id = meths.nvim_buf_set_extmark(0, ns, 1, 4, { end_row = 1, end_col = 10, spell = true }) + local id = api.nvim_buf_set_extmark(0, ns, 1, 4, { end_row = 1, end_col = 10, spell = true }) screen:expect([[ {3:#include }{4:<stdbool.h>} | {5:bool} {1:func}({5:void}); | @@ -277,9 +277,9 @@ describe("'spell'", function() {0:~ }|*4 | ]]) - meths.nvim_buf_del_extmark(0, ns, id) + api.nvim_buf_del_extmark(0, ns, id) -- extmark with spell=false disables spell - id = meths.nvim_buf_set_extmark(0, ns, 2, 18, { end_row = 2, end_col = 26, spell = false }) + id = api.nvim_buf_set_extmark(0, ns, 2, 18, { end_row = 2, end_col = 26, spell = false }) screen:expect([[ {3:#include }{4:<stdbool.h>} | {5:bool} ^func({5:void}); | @@ -296,7 +296,7 @@ describe("'spell'", function() {6:search hit TOP, continuing at BOTTOM} | ]]) exec('echo ""') - meths.nvim_buf_del_extmark(0, ns, id) + api.nvim_buf_del_extmark(0, ns, id) screen:expect([[ {3:#include }{4:<stdbool.h>} | {5:bool} func({5:void}); | @@ -367,8 +367,8 @@ describe("'spell'", function() syntax match Constant "^.*$" call setline(1, "This is some text without any spell errors.") ]]) - local ns = meths.nvim_create_namespace('spell') - meths.nvim_buf_set_extmark(0, ns, 0, 0, { hl_group = 'WarningMsg', end_col = 43 }) + local ns = api.nvim_create_namespace('spell') + api.nvim_buf_set_extmark(0, ns, 0, 0, { hl_group = 'WarningMsg', end_col = 43 }) screen:expect([[ {6:^This is some text without any spell errors.}| {0:~ }| diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index 7e0ba85500..dec696d3c3 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -7,7 +7,7 @@ local exec = helpers.exec local eval = helpers.eval local exec_lua = helpers.exec_lua local feed = helpers.feed -local meths = helpers.meths +local api = helpers.api local pcall_err = helpers.pcall_err local assert_alive = helpers.assert_alive @@ -543,60 +543,56 @@ describe('statuscolumn', function() end) it('clicks work with mousemodel=' .. model, function() - meths.nvim_set_option_value('statuscolumn', '%0@MyClickFunc@%=%l%T', {}) - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_set_option_value('statuscolumn', '%0@MyClickFunc@%=%l%T', {}) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) eq('0 1 l 4', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) eq('0 2 l 4', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) eq('0 3 l 4', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) eq('0 4 l 4', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 3, 0) + api.nvim_input_mouse('right', 'press', '', 0, 3, 0) eq('0 1 r 7', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 3, 0) + api.nvim_input_mouse('right', 'press', '', 0, 3, 0) eq('0 2 r 7', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 3, 0) + api.nvim_input_mouse('right', 'press', '', 0, 3, 0) eq('0 3 r 7', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 3, 0) + api.nvim_input_mouse('right', 'press', '', 0, 3, 0) eq('0 4 r 7', eval('g:testvar')) command('rightbelow vsplit') - meths.nvim_input_mouse('left', 'press', '', 0, 0, 27) + api.nvim_input_mouse('left', 'press', '', 0, 0, 27) eq('0 1 l 4', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 3, 27) + api.nvim_input_mouse('right', 'press', '', 0, 3, 27) eq('0 1 r 7', eval('g:testvar')) command('setlocal rightleft') - meths.nvim_input_mouse('left', 'press', '', 0, 0, 52) + api.nvim_input_mouse('left', 'press', '', 0, 0, 52) eq('0 1 l 4', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 3, 52) + api.nvim_input_mouse('right', 'press', '', 0, 3, 52) eq('0 1 r 7', eval('g:testvar')) command('wincmd H') - meths.nvim_input_mouse('left', 'press', '', 0, 0, 25) + api.nvim_input_mouse('left', 'press', '', 0, 0, 25) eq('0 1 l 4', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 3, 25) + api.nvim_input_mouse('right', 'press', '', 0, 3, 25) eq('0 1 r 7', eval('g:testvar')) command('close') command('set laststatus=2 winbar=%f') command('let g:testvar = ""') -- Check that winbar click doesn't register as statuscolumn click - meths.nvim_input_mouse('right', 'press', '', 0, 0, 0) + api.nvim_input_mouse('right', 'press', '', 0, 0, 0) eq('', eval('g:testvar')) -- Check that statusline click doesn't register as statuscolumn click - meths.nvim_input_mouse('right', 'press', '', 0, 12, 0) + api.nvim_input_mouse('right', 'press', '', 0, 12, 0) eq('', eval('g:testvar')) -- Check that cmdline click doesn't register as statuscolumn click - meths.nvim_input_mouse('right', 'press', '', 0, 13, 0) + api.nvim_input_mouse('right', 'press', '', 0, 13, 0) eq('', eval('g:testvar')) end) it('clicks and highlights work with control characters', function() - meths.nvim_set_option_value( - 'statuscolumn', - '\t%#NonText#\1%0@MyClickFunc@\t\1%T\t%##\1', - {} - ) + api.nvim_set_option_value('statuscolumn', '\t%#NonText#\1%0@MyClickFunc@\t\1%T\t%##\1', {}) screen:expect { grid = [[ {1:^I}{0:^A^I^A^I}{1:^A}aaaaa |*4 @@ -609,13 +605,13 @@ describe('statuscolumn', function() [1] = { foreground = Screen.colors.Brown }, -- LineNr }, } - meths.nvim_input_mouse('right', 'press', '', 0, 4, 3) + api.nvim_input_mouse('right', 'press', '', 0, 4, 3) eq('', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 5, 8) + api.nvim_input_mouse('left', 'press', '', 0, 5, 8) eq('', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 4) + api.nvim_input_mouse('right', 'press', '', 0, 6, 4) eq('0 1 r 10', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 7, 7) + api.nvim_input_mouse('left', 'press', '', 0, 7, 7) eq('0 1 l 11', eval('g:testvar')) end) @@ -625,7 +621,7 @@ describe('statuscolumn', function() [0] = { foreground = Screen.colors.Brown }, [1] = { background = Screen.colors.Plum1 }, }) - meths.nvim_set_option_value('statuscolumn', '%0@MyClickFunc@%l%T', {}) + api.nvim_set_option_value('statuscolumn', '%0@MyClickFunc@%l%T', {}) exec([[ function! MyClickFunc(minwid, clicks, button, mods) let g:testvar = printf("%d %d %s %d", a:minwid, a:clicks, a:button, getmousepos().line) @@ -634,26 +630,26 @@ describe('statuscolumn', function() endfunction ]]) -- clicking an item does not drag mouse - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ {0:8 }^aaaaa | {1: Echo } | ]]) - meths.nvim_input_mouse('left', 'press', '', 0, 1, 5) - meths.nvim_input_mouse('left', 'release', '', 0, 1, 5) + api.nvim_input_mouse('left', 'press', '', 0, 1, 5) + api.nvim_input_mouse('left', 'release', '', 0, 1, 5) screen:expect([[ {0:8 }^aaaaa | 0 1 l 8 | ]]) command('echo') -- clicking outside to close the menu does not drag mouse - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ {0:8 }^aaaaa | {1: Echo } | ]]) - meths.nvim_input_mouse('left', 'press', '', 0, 0, 10) - meths.nvim_input_mouse('left', 'release', '', 0, 0, 10) + api.nvim_input_mouse('left', 'press', '', 0, 0, 10) + api.nvim_input_mouse('left', 'release', '', 0, 0, 10) screen:expect([[ {0:8 }^aaaaa | | diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua index 2d39312ea2..d1bf163ab8 100644 --- a/test/functional/ui/statusline_spec.lua +++ b/test/functional/ui/statusline_spec.lua @@ -5,8 +5,8 @@ local clear = helpers.clear local command = helpers.command local feed = helpers.feed local eq = helpers.eq -local funcs = helpers.funcs -local meths = helpers.meths +local fn = helpers.fn +local api = helpers.api local exec = helpers.exec local exec_lua = helpers.exec_lua local eval = helpers.eval @@ -39,35 +39,31 @@ for _, model in ipairs(mousemodels) do end) it('works', function() - meths.nvim_set_option_value( - 'statusline', - 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', - {} - ) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 16) + api.nvim_set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) + api.nvim_input_mouse('left', 'press', '', 0, 6, 16) eq('', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 29) + api.nvim_input_mouse('right', 'press', '', 0, 6, 29) eq('', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) + api.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 1 l', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) + api.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 2 l', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) + api.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 3 l', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) + api.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 4 l', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 28) + api.nvim_input_mouse('right', 'press', '', 0, 6, 28) eq('0 1 r', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 28) + api.nvim_input_mouse('right', 'press', '', 0, 6, 28) eq('0 2 r', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 28) + api.nvim_input_mouse('right', 'press', '', 0, 6, 28) eq('0 3 r', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 28) + api.nvim_input_mouse('right', 'press', '', 0, 6, 28) eq('0 4 r', eval('g:testvar')) end) it('works with control characters and highlight', function() - meths.nvim_set_option_value('statusline', '\t%#NonText#\1%0@MyClickFunc@\t\1%T\t%##\1', {}) + api.nvim_set_option_value('statusline', '\t%#NonText#\1%0@MyClickFunc@\t\1%T\t%##\1', {}) screen:expect { grid = [[ ^ | @@ -76,54 +72,50 @@ for _, model in ipairs(mousemodels) do | ]], } - meths.nvim_input_mouse('right', 'press', '', 0, 6, 3) + api.nvim_input_mouse('right', 'press', '', 0, 6, 3) eq('', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 8) + api.nvim_input_mouse('left', 'press', '', 0, 6, 8) eq('', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 4) + api.nvim_input_mouse('right', 'press', '', 0, 6, 4) eq('0 1 r', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 7) + api.nvim_input_mouse('left', 'press', '', 0, 6, 7) eq('0 1 l', eval('g:testvar')) end) it('works for winbar', function() - meths.nvim_set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) - meths.nvim_input_mouse('left', 'press', '', 0, 0, 17) + api.nvim_set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) + api.nvim_input_mouse('left', 'press', '', 0, 0, 17) eq('0 1 l', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 0, 17) + api.nvim_input_mouse('right', 'press', '', 0, 0, 17) eq('0 1 r', eval('g:testvar')) end) it('works for winbar in floating window', function() - meths.nvim_open_win( + api.nvim_open_win( 0, true, { width = 30, height = 4, relative = 'editor', row = 1, col = 5, border = 'single' } ) - meths.nvim_set_option_value( + api.nvim_set_option_value( 'winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', { scope = 'local' } ) - meths.nvim_input_mouse('left', 'press', '', 0, 2, 23) + api.nvim_input_mouse('left', 'press', '', 0, 2, 23) eq('0 1 l', eval('g:testvar')) end) it('works when there are multiple windows', function() command('split') - meths.nvim_set_option_value( - 'statusline', - 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', - {} - ) - meths.nvim_set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) - meths.nvim_input_mouse('left', 'press', '', 0, 0, 17) + api.nvim_set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) + api.nvim_set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) + api.nvim_input_mouse('left', 'press', '', 0, 0, 17) eq('0 1 l', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 4, 17) + api.nvim_input_mouse('right', 'press', '', 0, 4, 17) eq('0 1 r', eval('g:testvar')) - meths.nvim_input_mouse('middle', 'press', '', 0, 3, 17) + api.nvim_input_mouse('middle', 'press', '', 0, 3, 17) eq('0 1 m', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) + api.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 1 l', eval('g:testvar')) end) @@ -133,72 +125,64 @@ for _, model in ipairs(mousemodels) do vim.g.testvar = string.format("%d %d %s", minwid, clicks, button) end ]]) - meths.nvim_set_option_value( + api.nvim_set_option_value( 'statusline', 'Not clicky stuff %0@v:lua.clicky_func@Clicky stuff%T', {} ) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) + api.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 1 l', eval('g:testvar')) end) it('ignores unsupported click items', function() command('tabnew | tabprevious') - meths.nvim_set_option_value('statusline', '%2TNot clicky stuff%T', {}) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 0) - eq(1, meths.nvim_get_current_tabpage().id) - meths.nvim_set_option_value('statusline', '%2XNot clicky stuff%X', {}) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 0) - eq(2, #meths.nvim_list_tabpages()) + api.nvim_set_option_value('statusline', '%2TNot clicky stuff%T', {}) + api.nvim_input_mouse('left', 'press', '', 0, 6, 0) + eq(1, api.nvim_get_current_tabpage().id) + api.nvim_set_option_value('statusline', '%2XNot clicky stuff%X', {}) + api.nvim_input_mouse('left', 'press', '', 0, 6, 0) + eq(2, #api.nvim_list_tabpages()) end) it("right click works when statusline isn't focused #18994", function() - meths.nvim_set_option_value( - 'statusline', - 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', - {} - ) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 17) + api.nvim_set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) + api.nvim_input_mouse('right', 'press', '', 0, 6, 17) eq('0 1 r', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 17) + api.nvim_input_mouse('right', 'press', '', 0, 6, 17) eq('0 2 r', eval('g:testvar')) end) it('works with modifiers #18994', function() - meths.nvim_set_option_value( - 'statusline', - 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', - {} - ) + api.nvim_set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) -- Note: alternate between left and right mouse buttons to avoid triggering multiclicks - meths.nvim_input_mouse('left', 'press', 'S', 0, 6, 17) + api.nvim_input_mouse('left', 'press', 'S', 0, 6, 17) eq('0 1 l(s )', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', 'S', 0, 6, 17) + api.nvim_input_mouse('right', 'press', 'S', 0, 6, 17) eq('0 1 r(s )', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', 'A', 0, 6, 17) + api.nvim_input_mouse('left', 'press', 'A', 0, 6, 17) eq('0 1 l( a )', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', 'A', 0, 6, 17) + api.nvim_input_mouse('right', 'press', 'A', 0, 6, 17) eq('0 1 r( a )', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', 'AS', 0, 6, 17) + api.nvim_input_mouse('left', 'press', 'AS', 0, 6, 17) eq('0 1 l(s a )', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', 'AS', 0, 6, 17) + api.nvim_input_mouse('right', 'press', 'AS', 0, 6, 17) eq('0 1 r(s a )', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', 'T', 0, 6, 17) + api.nvim_input_mouse('left', 'press', 'T', 0, 6, 17) eq('0 1 l( m)', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', 'T', 0, 6, 17) + api.nvim_input_mouse('right', 'press', 'T', 0, 6, 17) eq('0 1 r( m)', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', 'TS', 0, 6, 17) + api.nvim_input_mouse('left', 'press', 'TS', 0, 6, 17) eq('0 1 l(s m)', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', 'TS', 0, 6, 17) + api.nvim_input_mouse('right', 'press', 'TS', 0, 6, 17) eq('0 1 r(s m)', eval('g:testvar')) - meths.nvim_input_mouse('left', 'press', 'C', 0, 6, 17) + api.nvim_input_mouse('left', 'press', 'C', 0, 6, 17) eq('0 1 l( c )', eval('g:testvar')) -- <C-RightMouse> is for tag jump end) it('works for global statusline with vertical splits #19186', function() command('set laststatus=3') - meths.nvim_set_option_value( + api.nvim_set_option_value( 'statusline', '%0@MyClickFunc@Clicky stuff%T %= %0@MyClickFunc@Clicky stuff%T', {} @@ -214,15 +198,15 @@ for _, model in ipairs(mousemodels) do } -- clickable area on the right - meths.nvim_input_mouse('left', 'press', '', 0, 6, 35) + api.nvim_input_mouse('left', 'press', '', 0, 6, 35) eq('0 1 l', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 35) + api.nvim_input_mouse('right', 'press', '', 0, 6, 35) eq('0 1 r', eval('g:testvar')) -- clickable area on the left - meths.nvim_input_mouse('left', 'press', '', 0, 6, 5) + api.nvim_input_mouse('left', 'press', '', 0, 6, 5) eq('0 1 l', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 5) + api.nvim_input_mouse('right', 'press', '', 0, 6, 5) eq('0 1 r', eval('g:testvar')) end) @@ -230,9 +214,9 @@ for _, model in ipairs(mousemodels) do command([[ let &stl = '%@Test@%T%@MyClickFunc@%=%T%@Test@' ]]) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 0) + api.nvim_input_mouse('left', 'press', '', 0, 6, 0) eq('0 1 l', eval('g:testvar')) - meths.nvim_input_mouse('right', 'press', '', 0, 6, 39) + api.nvim_input_mouse('right', 'press', '', 0, 6, 39) eq('0 1 r', eval('g:testvar')) end) @@ -240,7 +224,7 @@ for _, model in ipairs(mousemodels) do command([[ let &stl = '%@MyClickFunc@foo%X' .. repeat('a', 40) .. '%<t%@Test@bar%X%@Test@baz' ]]) - meths.nvim_input_mouse('left', 'press', '', 0, 6, 2) + api.nvim_input_mouse('left', 'press', '', 0, 6, 2) eq('0 1 l', eval('g:testvar')) end) end) @@ -382,38 +366,38 @@ describe('global statusline', function() end) it('win_move_statusline() can reduce cmdheight to 1', function() - eq(1, meths.nvim_get_option_value('cmdheight', {})) - funcs.win_move_statusline(0, -1) - eq(2, meths.nvim_get_option_value('cmdheight', {})) - funcs.win_move_statusline(0, -1) - eq(3, meths.nvim_get_option_value('cmdheight', {})) - funcs.win_move_statusline(0, 1) - eq(2, meths.nvim_get_option_value('cmdheight', {})) - funcs.win_move_statusline(0, 1) - eq(1, meths.nvim_get_option_value('cmdheight', {})) + eq(1, api.nvim_get_option_value('cmdheight', {})) + fn.win_move_statusline(0, -1) + eq(2, api.nvim_get_option_value('cmdheight', {})) + fn.win_move_statusline(0, -1) + eq(3, api.nvim_get_option_value('cmdheight', {})) + fn.win_move_statusline(0, 1) + eq(2, api.nvim_get_option_value('cmdheight', {})) + fn.win_move_statusline(0, 1) + eq(1, api.nvim_get_option_value('cmdheight', {})) end) it('mouse dragging can reduce cmdheight to 1', function() command('set mouse=a') - meths.nvim_input_mouse('left', 'press', '', 0, 14, 10) - eq(1, meths.nvim_get_option_value('cmdheight', {})) - meths.nvim_input_mouse('left', 'drag', '', 0, 13, 10) - eq(2, meths.nvim_get_option_value('cmdheight', {})) - meths.nvim_input_mouse('left', 'drag', '', 0, 12, 10) - eq(3, meths.nvim_get_option_value('cmdheight', {})) - meths.nvim_input_mouse('left', 'drag', '', 0, 13, 10) - eq(2, meths.nvim_get_option_value('cmdheight', {})) - meths.nvim_input_mouse('left', 'drag', '', 0, 14, 10) - eq(1, meths.nvim_get_option_value('cmdheight', {})) - meths.nvim_input_mouse('left', 'drag', '', 0, 15, 10) - eq(1, meths.nvim_get_option_value('cmdheight', {})) - meths.nvim_input_mouse('left', 'drag', '', 0, 14, 10) - eq(1, meths.nvim_get_option_value('cmdheight', {})) + api.nvim_input_mouse('left', 'press', '', 0, 14, 10) + eq(1, api.nvim_get_option_value('cmdheight', {})) + api.nvim_input_mouse('left', 'drag', '', 0, 13, 10) + eq(2, api.nvim_get_option_value('cmdheight', {})) + api.nvim_input_mouse('left', 'drag', '', 0, 12, 10) + eq(3, api.nvim_get_option_value('cmdheight', {})) + api.nvim_input_mouse('left', 'drag', '', 0, 13, 10) + eq(2, api.nvim_get_option_value('cmdheight', {})) + api.nvim_input_mouse('left', 'drag', '', 0, 14, 10) + eq(1, api.nvim_get_option_value('cmdheight', {})) + api.nvim_input_mouse('left', 'drag', '', 0, 15, 10) + eq(1, api.nvim_get_option_value('cmdheight', {})) + api.nvim_input_mouse('left', 'drag', '', 0, 14, 10) + eq(1, api.nvim_get_option_value('cmdheight', {})) end) it('cmdline row is correct after setting cmdheight #20514', function() command('botright split test/functional/fixtures/bigfile.txt') - meths.nvim_set_option_value('cmdheight', 1, {}) + api.nvim_set_option_value('cmdheight', 1, {}) feed('L') screen:expect([[ | @@ -444,7 +428,7 @@ describe('global statusline', function() {2:test/functional/fixtures/bigfile.txt 8,1 0%}| | ]]) - meths.nvim_set_option_value('showtabline', 2, {}) + api.nvim_set_option_value('showtabline', 2, {}) screen:expect([[ {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| | @@ -459,7 +443,7 @@ describe('global statusline', function() {2:test/functional/fixtures/bigfile.txt 8,1 0%}| | ]]) - meths.nvim_set_option_value('cmdheight', 0, {}) + api.nvim_set_option_value('cmdheight', 0, {}) screen:expect([[ {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| | @@ -474,7 +458,7 @@ describe('global statusline', function() ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | {2:test/functional/fixtures/bigfile.txt 8,1 0%}| ]]) - meths.nvim_set_option_value('cmdheight', 1, {}) + api.nvim_set_option_value('cmdheight', 1, {}) screen:expect([[ {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| | @@ -494,8 +478,8 @@ end) it('statusline does not crash if it has Arabic characters #19447', function() clear() - meths.nvim_set_option_value('statusline', 'غً', {}) - meths.nvim_set_option_value('laststatus', 2, {}) + api.nvim_set_option_value('statusline', 'غً', {}) + api.nvim_set_option_value('laststatus', 2, {}) command('redraw!') assert_alive() end) diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua index 9a75e6333b..d58155ef0c 100644 --- a/test/functional/ui/tabline_spec.lua +++ b/test/functional/ui/tabline_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, command, eq = helpers.clear, helpers.command, helpers.eq local insert = helpers.insert -local meths = helpers.meths +local api = helpers.api local assert_alive = helpers.assert_alive describe('ui/ext_tabline', function() @@ -138,7 +138,7 @@ describe('tabline', function() command('tabnew') insert('tab2') command('tabprev') - meths.nvim_set_option_value('tabline', '%1T口口%2Ta' .. ('b'):rep(38) .. '%999Xc', {}) + api.nvim_set_option_value('tabline', '%1T口口%2Ta' .. ('b'):rep(38) .. '%999Xc', {}) screen:expect { grid = [[ {1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| @@ -148,7 +148,7 @@ describe('tabline', function() ]], } assert_alive() - meths.nvim_input_mouse('left', 'press', '', 0, 0, 1) + api.nvim_input_mouse('left', 'press', '', 0, 0, 1) screen:expect { grid = [[ {1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| @@ -157,7 +157,7 @@ describe('tabline', function() | ]], } - meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) + api.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect { grid = [[ {1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| @@ -166,7 +166,7 @@ describe('tabline', function() | ]], } - meths.nvim_input_mouse('left', 'press', '', 0, 0, 39) + api.nvim_input_mouse('left', 'press', '', 0, 0, 39) screen:expect { grid = [[ {1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| @@ -175,7 +175,7 @@ describe('tabline', function() | ]], } - meths.nvim_input_mouse('left', 'press', '', 0, 0, 40) + api.nvim_input_mouse('left', 'press', '', 0, 0, 40) screen:expect { grid = [[ tab^1 | diff --git a/test/functional/ui/title_spec.lua b/test/functional/ui/title_spec.lua index 598952404d..c77e836d21 100644 --- a/test/functional/ui/title_spec.lua +++ b/test/functional/ui/title_spec.lua @@ -2,12 +2,12 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear = helpers.clear local command = helpers.command -local curwin = helpers.meths.nvim_get_current_win +local curwin = helpers.api.nvim_get_current_win local eq = helpers.eq local exec_lua = helpers.exec_lua local feed = helpers.feed -local funcs = helpers.funcs -local meths = helpers.meths +local fn = helpers.fn +local api = helpers.api local is_os = helpers.is_os describe('title', function() @@ -44,7 +44,7 @@ describe('title', function() before_each(function() command('edit ' .. file1) - buf2 = funcs.bufadd(file2) + buf2 = fn.bufadd(file2) command('set title') end) @@ -58,7 +58,7 @@ describe('title', function() end) it('an RPC call to nvim_set_option_value in a hidden buffer', function() - meths.nvim_set_option_value('autoindent', true, { buf = buf2 }) + api.nvim_set_option_value('autoindent', true, { buf = buf2 }) command('redraw!') screen:expect(function() eq(expected, screen.title) @@ -98,7 +98,7 @@ describe('title', function() it('setting the buffer of another window using RPC', function() local oldwin = curwin().id command('split') - meths.nvim_win_set_buf(oldwin, buf2) + api.nvim_win_set_buf(oldwin, buf2) command('redraw!') screen:expect(function() eq(expected, screen.title) @@ -124,7 +124,7 @@ describe('title', function() end) it('creating a floating window using RPC', function() - meths.nvim_open_win(buf2, false, { + api.nvim_open_win(buf2, false, { relative = 'editor', width = 5, height = 5, diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 45eb9222c2..4ad0326851 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -1,8 +1,8 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed, command = helpers.clear, helpers.feed, helpers.command -local funcs = helpers.funcs -local meths = helpers.meths +local fn = helpers.fn +local api = helpers.api local eq = helpers.eq local eval = helpers.eval local retry = helpers.retry @@ -413,12 +413,12 @@ describe("'wildmenu'", function() } -- Wildcharm? where we are going we aint't no need no wildcharm. - eq(0, meths.nvim_get_option_value('wildcharm', {})) + eq(0, api.nvim_get_option_value('wildcharm', {})) -- Don't mess the defaults yet (neovim is about backwards compatibility) - eq(9, meths.nvim_get_option_value('wildchar', {})) + eq(9, api.nvim_get_option_value('wildchar', {})) -- Lol what is cnoremap? Some say it can define mappings. command 'set wildchar=0' - eq(0, meths.nvim_get_option_value('wildchar', {})) + eq(0, api.nvim_get_option_value('wildchar', {})) command 'cnoremap <f2> <c-z>' feed(':syntax <f2>') @@ -483,7 +483,7 @@ describe('command line completion', function() end) it('lists directories with empty PATH', function() - local tmp = funcs.tempname() + local tmp = fn.tempname() command('e ' .. tmp) command('cd %:h') command("call mkdir('Xtest-functional-viml-compl-dir')") @@ -525,9 +525,9 @@ describe('command line completion', function() end) it('does not leak memory with <S-Tab> with wildmenu and only one match #19874', function() - meths.nvim_set_option_value('wildmenu', true, {}) - meths.nvim_set_option_value('wildmode', 'full', {}) - meths.nvim_set_option_value('wildoptions', 'pum', {}) + api.nvim_set_option_value('wildmenu', true, {}) + api.nvim_set_option_value('wildmode', 'full', {}) + api.nvim_set_option_value('wildoptions', 'pum', {}) feed(':sign unpla<S-Tab>') screen:expect([[ @@ -545,8 +545,8 @@ describe('command line completion', function() end) it('does not show matches with <S-Tab> without wildmenu with wildmode=full', function() - meths.nvim_set_option_value('wildmenu', false, {}) - meths.nvim_set_option_value('wildmode', 'full', {}) + api.nvim_set_option_value('wildmenu', false, {}) + api.nvim_set_option_value('wildmode', 'full', {}) feed(':sign <S-Tab>') screen:expect([[ @@ -557,8 +557,8 @@ describe('command line completion', function() end) it('shows matches with <S-Tab> without wildmenu with wildmode=list', function() - meths.nvim_set_option_value('wildmenu', false, {}) - meths.nvim_set_option_value('wildmode', 'list', {}) + api.nvim_set_option_value('wildmenu', false, {}) + api.nvim_set_option_value('wildmode', 'list', {}) feed(':sign <S-Tab>') screen:expect([[ diff --git a/test/functional/ui/winbar_spec.lua b/test/functional/ui/winbar_spec.lua index 5e914952e3..858a537d3a 100644 --- a/test/functional/ui/winbar_spec.lua +++ b/test/functional/ui/winbar_spec.lua @@ -3,11 +3,11 @@ local Screen = require('test.functional.ui.screen') local clear = helpers.clear local command = helpers.command local insert = helpers.insert -local meths = helpers.meths +local api = helpers.api local eq = helpers.eq local poke_eventloop = helpers.poke_eventloop local feed = helpers.feed -local funcs = helpers.funcs +local fn = helpers.fn local pcall_err = helpers.pcall_err describe('winbar', function() @@ -39,7 +39,7 @@ describe('winbar', function() foreground = Screen.colors.Magenta, }, }) - meths.nvim_set_option_value('winbar', 'Set Up The Bars', {}) + api.nvim_set_option_value('winbar', 'Set Up The Bars', {}) end) it('works', function() @@ -50,8 +50,8 @@ describe('winbar', function() | ]]) -- winbar is excluded from the heights returned by winheight() and getwininfo() - eq(11, funcs.winheight(0)) - local win_info = funcs.getwininfo(meths.nvim_get_current_win().id)[1] + eq(11, fn.winheight(0)) + local win_info = fn.getwininfo(api.nvim_get_current_win().id)[1] eq(11, win_info.height) eq(1, win_info.winbar) end) @@ -184,7 +184,7 @@ describe('winbar', function() insert [[ just some random text]] - meths.nvim_set_option_value('winbar', 'Hello, I am a ruler: %l,%c', {}) + api.nvim_set_option_value('winbar', 'Hello, I am a ruler: %l,%c', {}) screen:expect { grid = [[ {1:Hello, I am a ruler: 2,11 }| @@ -264,7 +264,7 @@ describe('winbar', function() line sin(theta) line 8]]) - meths.nvim_input_mouse('left', 'press', '', 0, 5, 1) + api.nvim_input_mouse('left', 'press', '', 0, 5, 1) screen:expect([[ {1:Set Up The Bars }| line 1 | @@ -278,9 +278,9 @@ describe('winbar', function() {3:~ }|*3 | ]]) - eq({ 5, 1 }, meths.nvim_win_get_cursor(0)) + eq({ 5, 1 }, api.nvim_win_get_cursor(0)) - meths.nvim_input_mouse('left', 'drag', '', 0, 6, 2) + api.nvim_input_mouse('left', 'drag', '', 0, 6, 2) screen:expect([[ {1:Set Up The Bars }| line 1 | @@ -294,9 +294,9 @@ describe('winbar', function() {3:~ }|*3 {1:-- VISUAL --} | ]]) - eq({ 6, 2 }, meths.nvim_win_get_cursor(0)) + eq({ 6, 2 }, api.nvim_win_get_cursor(0)) - meths.nvim_input_mouse('left', 'drag', '', 0, 1, 2) + api.nvim_input_mouse('left', 'drag', '', 0, 1, 2) screen:expect([[ {1:Set Up The Bars }| li^n{7:e 1} | @@ -310,11 +310,11 @@ describe('winbar', function() {3:~ }|*3 {1:-- VISUAL --} | ]]) - eq({ 1, 2 }, meths.nvim_win_get_cursor(0)) + eq({ 1, 2 }, api.nvim_win_get_cursor(0)) - meths.nvim_input_mouse('left', 'drag', '', 0, 0, 2) + api.nvim_input_mouse('left', 'drag', '', 0, 0, 2) screen:expect_unchanged() - eq({ 1, 2 }, meths.nvim_win_get_cursor(0)) + eq({ 1, 2 }, api.nvim_win_get_cursor(0)) end) it('dragging statusline with mouse works correctly', function() @@ -331,9 +331,9 @@ describe('winbar', function() | ]]) - meths.nvim_input_mouse('left', 'press', '', 1, 5, 10) + api.nvim_input_mouse('left', 'press', '', 1, 5, 10) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 1, 6, 10) + api.nvim_input_mouse('left', 'drag', '', 1, 6, 10) screen:expect([[ {1:Set Up The Bars }| ^ | @@ -346,7 +346,7 @@ describe('winbar', function() | ]]) - meths.nvim_input_mouse('left', 'drag', '', 1, 4, 10) + api.nvim_input_mouse('left', 'drag', '', 1, 4, 10) screen:expect([[ {1:Set Up The Bars }| ^ | @@ -359,9 +359,9 @@ describe('winbar', function() | ]]) - meths.nvim_input_mouse('left', 'press', '', 1, 11, 10) + api.nvim_input_mouse('left', 'press', '', 1, 11, 10) poke_eventloop() - meths.nvim_input_mouse('left', 'drag', '', 1, 9, 10) + api.nvim_input_mouse('left', 'drag', '', 1, 9, 10) screen:expect([[ {1:Set Up The Bars }| ^ | @@ -373,9 +373,9 @@ describe('winbar', function() {2:[No Name] }| |*3 ]]) - eq(3, meths.nvim_get_option_value('cmdheight', {})) + eq(3, api.nvim_get_option_value('cmdheight', {})) - meths.nvim_input_mouse('left', 'drag', '', 1, 11, 10) + api.nvim_input_mouse('left', 'drag', '', 1, 11, 10) screen:expect([[ {1:Set Up The Bars }| ^ | @@ -387,7 +387,7 @@ describe('winbar', function() {2:[No Name] }| | ]]) - eq(1, meths.nvim_get_option_value('cmdheight', {})) + eq(1, api.nvim_get_option_value('cmdheight', {})) end) it('properly equalizes window height for window-local value', function() @@ -412,12 +412,12 @@ describe('winbar', function() end) it('requires window-local value for floating windows', function() - local win = meths.nvim_open_win( + local win = api.nvim_open_win( 0, false, { relative = 'editor', row = 2, col = 10, height = 7, width = 30 } ) - meths.nvim_set_option_value('winbar', 'bar', {}) + api.nvim_set_option_value('winbar', 'bar', {}) screen:expect { grid = [[ {1:bar }| @@ -428,7 +428,7 @@ describe('winbar', function() | ]], } - meths.nvim_set_option_value('winbar', 'floaty bar', { scope = 'local', win = win.id }) + api.nvim_set_option_value('winbar', 'floaty bar', { scope = 'local', win = win.id }) screen:expect { grid = [[ {1:bar }| @@ -531,7 +531,7 @@ describe('local winbar with tabs', function() [3] = { bold = true, foreground = Screen.colors.Blue }, [4] = { underline = true, background = Screen.colors.LightGray }, }) - meths.nvim_set_option_value('winbar', 'foo', { scope = 'local', win = 0 }) + api.nvim_set_option_value('winbar', 'foo', { scope = 'local', win = 0 }) end) it('works', function() |