diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 12:44:54 +0000 |
|---|---|---|
| committer | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 13:01:06 +0000 |
| commit | c30f2e3182e3b50e7c03932027ac55edfc8ada4a (patch) | |
| tree | edf0a76dba282d946f67fe70fff8c6cbe28e7a82 /test/functional/ui | |
| parent | 284e0ad26dd9de90c3a813dd1b357a425eca6bad (diff) | |
| download | rneovim-c30f2e3182e3b50e7c03932027ac55edfc8ada4a.tar.gz rneovim-c30f2e3182e3b50e7c03932027ac55edfc8ada4a.tar.bz2 rneovim-c30f2e3182e3b50e7c03932027ac55edfc8ada4a.zip | |
test: typing for helpers.meths
Diffstat (limited to 'test/functional/ui')
27 files changed, 1213 insertions, 1178 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua index 220537f58a..13fea71fec 100644 --- a/test/functional/ui/bufhl_spec.lua +++ b/test/functional/ui/bufhl_spec.lua @@ -494,7 +494,7 @@ describe('Buffer highlighting', function() it('respects priority', function() local set_extmark = curbufmeths.set_extmark - local id = meths.create_namespace('') + local id = meths.nvim_create_namespace('') insert [[foobar]] set_extmark(id, 0, 0, { @@ -901,9 +901,9 @@ describe('Buffer highlighting', function() local set_virtual_text = curbufmeths.set_virtual_text eq(1, add_highlight(0, 'String', 0, 0, -1)) eq(2, set_virtual_text(0, 0, { { '= text', 'Comment' } }, {})) - eq(3, meths.create_namespace('my-ns')) + eq(3, meths.nvim_create_namespace('my-ns')) eq(4, add_highlight(0, 'String', 0, 0, -1)) eq(5, set_virtual_text(0, 0, { { '= text', 'Comment' } }, {})) - eq(6, meths.create_namespace('other-ns')) + eq(6, meths.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 4b3657f834..99f6e2eed8 100644 --- a/test/functional/ui/cmdline_highlight_spec.lua +++ b/test/functional/ui/cmdline_highlight_spec.lua @@ -157,16 +157,16 @@ before_each(function() end) local function set_color_cb(funcname, callback_return, id) - meths.set_var('id', id or '') + meths.nvim_set_var('id', id or '') if id and id ~= '' and funcs.exists('*' .. funcname .. 'N') then command(('let g:Nvim_color_input%s = {cmdline -> %sN(%s, cmdline)}'):format(id, funcname, id)) if callback_return then - meths.set_var('callback_return' .. id, callback_return) + meths.nvim_set_var('callback_return' .. id, callback_return) end else - meths.set_var('Nvim_color_input', funcname) + meths.nvim_set_var('Nvim_color_input', funcname) if callback_return then - meths.set_var('callback_return', callback_return) + meths.nvim_set_var('callback_return', callback_return) end end end @@ -177,7 +177,7 @@ end describe('Command-line coloring', function() it('works', function() set_color_cb('RainBowParens') - meths.set_option_value('more', false, {}) + meths.nvim_set_option_value('more', false, {}) start_prompt() screen:expect([[ | @@ -362,7 +362,7 @@ describe('Command-line coloring', function() | ]]) feed('\n') - eq('let x = "«»«»«»«»«»"', meths.get_var('out')) + eq('let x = "«»«»«»«»«»"', meths.nvim_get_var('out')) local msg = '\nE5405: Chunk 0 start 10 splits multibyte character' eq(msg:rep(1), funcs.execute('messages')) end) @@ -398,7 +398,7 @@ describe('Command-line coloring', function() :echo 42 | ]]) feed('\n') - eq('echo 42', meths.get_var('out')) + eq('echo 42', meths.nvim_get_var('out')) feed('<C-c>') screen:expect([[ ^ | @@ -564,16 +564,16 @@ describe('Command-line coloring', function() {EOB:~ }|*6 | ]]) - eq('1234', meths.get_var('out')) - eq('234', meths.get_var('out1')) - eq('34', meths.get_var('out2')) - eq('4', meths.get_var('out3')) + 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')) end) it('runs callback with the same data only once', function() local function new_recording_calls(...) - eq({ ... }, meths.get_var('recording_calls')) - meths.set_var('recording_calls', {}) + eq({ ... }, meths.nvim_get_var('recording_calls')) + meths.nvim_set_var('recording_calls', {}) end set_color_cb('Recording') start_prompt('') @@ -594,7 +594,7 @@ describe('Command-line coloring', function() feed('<BS>') new_recording_calls() -- ('a') feed('<CR><CR>') - eq('', meths.get_var('out')) + eq('', meths.nvim_get_var('out')) end) it('does not crash when callback has caught not-a-editor-command exception', function() source([[ @@ -609,12 +609,12 @@ describe('Command-line coloring', function() ]]) set_color_cb('CaughtExc') start_prompt('1') - eq(1, meths.eval('1')) + eq(1, meths.nvim_eval('1')) end) end) describe('Ex commands coloring', function() it('works', function() - meths.set_var('Nvim_color_cmdline', 'RainBowParens') + meths.nvim_set_var('Nvim_color_cmdline', 'RainBowParens') feed(':echo (((1)))') screen:expect([[ | @@ -623,9 +623,9 @@ describe('Ex commands coloring', function() ]]) end) it('still executes command-line even if errored out', function() - meths.set_var('Nvim_color_cmdline', 'SplitMultibyteStart') + meths.nvim_set_var('Nvim_color_cmdline', 'SplitMultibyteStart') feed(':let x = "«"\n') - eq('«', meths.get_var('x')) + eq('«', meths.nvim_get_var('x')) local msg = 'E5405: Chunk 0 start 10 splits multibyte character' eq('\n' .. msg, funcs.execute('messages')) end) @@ -709,7 +709,7 @@ describe('Ex commands coloring', function() ) end) it('errors out when failing to get callback', function() - meths.set_var('Nvim_color_cmdline', 42) + meths.nvim_set_var('Nvim_color_cmdline', 42) feed(':#') screen:expect([[ | @@ -725,10 +725,10 @@ describe('Ex commands coloring', function() end) describe('Expressions coloring support', function() it('works', function() - meths.command('hi clear NvimNumber') - meths.command('hi clear NvimNestingParenthesis') - meths.command('hi NvimNumber guifg=Blue2') - meths.command('hi NvimNestingParenthesis guifg=Yellow') + meths.nvim_command('hi clear NvimNumber') + meths.nvim_command('hi clear NvimNestingParenthesis') + meths.nvim_command('hi NvimNumber guifg=Blue2') + meths.nvim_command('hi NvimNestingParenthesis guifg=Yellow') feed(':echo <C-r>=(((1)))') screen:expect([[ | @@ -737,10 +737,10 @@ describe('Expressions coloring support', function() ]]) end) it('does not use Nvim_color_expr', function() - meths.set_var('Nvim_color_expr', 42) + meths.nvim_set_var('Nvim_color_expr', 42) -- Used to error out due to failing to get callback. - meths.command('hi clear NvimNumber') - meths.command('hi NvimNumber guifg=Blue2') + meths.nvim_command('hi clear NvimNumber') + meths.nvim_command('hi NvimNumber guifg=Blue2') feed(':<C-r>=1') screen:expect([[ | @@ -749,12 +749,12 @@ describe('Expressions coloring support', function() ]]) end) it('works correctly with non-ASCII and control characters', function() - meths.command('hi clear NvimStringBody') - meths.command('hi clear NvimStringQuote') - meths.command('hi clear NvimInvalid') - meths.command('hi NvimStringQuote guifg=Blue3') - meths.command('hi NvimStringBody guifg=Blue4') - meths.command('hi NvimInvalid guifg=Red guibg=Blue') + meths.nvim_command('hi clear NvimStringBody') + meths.nvim_command('hi clear NvimStringQuote') + meths.nvim_command('hi clear NvimInvalid') + meths.nvim_command('hi NvimStringQuote guifg=Blue3') + meths.nvim_command('hi NvimStringBody guifg=Blue4') + meths.nvim_command('hi NvimInvalid guifg=Red guibg=Blue') feed('i<C-r>="«»"«»') screen:expect([[ | diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 82ff633fcb..2670288cbb 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -922,7 +922,7 @@ describe('cmdline redraw', function() it('with rightleftcmd', function() command('set rightleft rightleftcmd=search shortmess+=s') - meths.buf_set_lines(0, 0, -1, true, { "let's rock!" }) + meths.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.buf_set_lines(0, 0, -1, true, { 'p' }) + meths.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.input_mouse('left', 'press', '', 0, 6, 10) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 10) poke_eventloop() - meths.input_mouse('left', 'drag', '', 0, 5, 10) + meths.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 9b3de1e108..601d242de0 100644 --- a/test/functional/ui/cursor_spec.lua +++ b/test/functional/ui/cursor_spec.lua @@ -299,7 +299,7 @@ describe('ui/cursor', function() } -- Another cursor style. - meths.set_option_value( + meths.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.set_option_value( + meths.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.set_option_value('guicursor', '', {}) + meths.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 6ff2a12ded..91a5f10c84 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -243,7 +243,7 @@ describe('decorations providers', function() ]]} -- spell=false with higher priority does disable spell - local ns = meths.create_namespace "spell" + local ns = meths.nvim_create_namespace "spell" local id = curbufmeths.set_extmark(ns, 0, 0, { priority = 30, end_row = 2, end_col = 23, spell = false }) screen:expect{grid=[[ @@ -306,7 +306,7 @@ describe('decorations providers', function() LineNr = {italic=true, bg="Magenta"}; Comment = {fg="#FF0000", bg = 80*256+40}; CursorLine = {link="ErrorMsg"}; - } do meths.set_hl(ns1, k, v) end + } do meths.nvim_set_hl(ns1, k, v) end screen:expect{grid=[[ {3: 1 }{4:// just to see if there was an accid}| @@ -327,7 +327,7 @@ describe('decorations providers', function() | ]]} - meths.set_hl_ns(ns1) + meths.nvim_set_hl_ns(ns1) screen:expect{grid=[[ {10: 1 }{11:// just to see if there was an accid}| {10: }{11:ent} | @@ -387,7 +387,7 @@ describe('decorations providers', function() highlight link LinkGroup OriginalGroup ]] - meths.buf_set_virtual_text(0, 0, 2, {{'- not red', 'LinkGroup'}}, {}) + meths.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 | @@ -399,8 +399,8 @@ describe('decorations providers', function() | ]]} - meths.set_hl(ns1, 'LinkGroup', {fg = 'Blue'}) - meths.set_hl_ns(ns1) + meths.nvim_set_hl(ns1, 'LinkGroup', {fg = 'Blue'}) + meths.nvim_set_hl_ns(ns1) screen:expect{grid=[[ // just to see if there was an accident | @@ -423,7 +423,7 @@ describe('decorations providers', function() highlight link LinkGroup OriginalGroup ]] - meths.buf_set_virtual_text(0, 0, 2, {{'- not red', 'LinkGroup'}}, {}) + meths.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 | @@ -435,8 +435,8 @@ describe('decorations providers', function() | ]]} - meths.set_hl(ns1, 'LinkGroup', {fg = 'Blue', default=true}) - meths.set_hl_ns(ns1) + meths.nvim_set_hl(ns1, 'LinkGroup', {fg = 'Blue', default=true}) + meths.nvim_set_hl_ns(ns1) feed 'k' screen:expect{grid=[[ @@ -626,7 +626,7 @@ describe('decorations providers', function() end ]]) command([[autocmd CursorMoved * call line('w$')]]) - meths.win_set_cursor(0, {100, 0}) + meths.nvim_win_set_cursor(0, {100, 0}) screen:expect([[ {14: }hello97 | {14: }hello98 | @@ -637,7 +637,7 @@ describe('decorations providers', function() {14: }hello103 | | ]]) - meths.win_set_cursor(0, {1, 0}) + meths.nvim_win_set_cursor(0, {1, 0}) screen:expect([[ ^hello1 | hello2 | @@ -766,7 +766,7 @@ describe('extmark decorations', function() [43] = {background = Screen.colors.Yellow, undercurl = true, special = Screen.colors.Red}; } - ns = meths.create_namespace 'test' + ns = meths.nvim_create_namespace 'test' end) it('empty virtual text at eol should not break colorcolumn #17860', function() @@ -789,7 +789,7 @@ describe('extmark decorations', function() {1:~ }|*2 | ]]) - meths.buf_set_extmark(0, ns, 4, 0, { virt_text={{''}}, virt_text_pos='eol'}) + meths.nvim_buf_set_extmark(0, ns, 4, 0, { virt_text={{''}}, virt_text_pos='eol'}) screen:expect_unchanged() end) @@ -798,19 +798,19 @@ describe('extmark decorations', function() feed 'gg' for i = 1,9 do - meths.buf_set_extmark(0, ns, i, 0, { virt_text={{'|', 'LineNr'}}, virt_text_pos='overlay'}) + meths.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.buf_set_extmark(0, ns, i, 4, { virt_text={{'|', 'NonText'}}, virt_text_pos='overlay'}) + meths.nvim_buf_set_extmark(0, ns, i, 4, { virt_text={{'|', 'NonText'}}, virt_text_pos='overlay'}) end end - meths.buf_set_extmark(0, ns, 9, 10, { virt_text={{'foo'}, {'bar', 'MoreMsg'}, {'!!', 'ErrorMsg'}}, virt_text_pos='overlay'}) + meths.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.buf_set_extmark(0, ns, 5, 28, { virt_text={{'loopy', 'ErrorMsg'}}, virt_text_pos='overlay'}) + meths.nvim_buf_set_extmark(0, ns, 5, 28, { virt_text={{'loopy', 'ErrorMsg'}}, virt_text_pos='overlay'}) -- bound check: right edge of window - meths.buf_set_extmark(0, ns, 2, 26, { virt_text={{'bork bork bork'}, {(' bork'):rep(10), 'ErrorMsg'}}, virt_text_pos='overlay'}) + meths.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.buf_set_extmark(0, ns, 6, 16, { virt_text={{''}}, virt_text_pos='overlay'}) + meths.nvim_buf_set_extmark(0, ns, 6, 16, { virt_text={{''}}, virt_text_pos='overlay'}) screen:expect{grid=[[ ^for _,item in ipairs(items) do | @@ -859,12 +859,12 @@ describe('extmark decorations', function() ]]} -- truncating in the middle of a char leaves a space - meths.buf_set_lines(0, 0, 1, true, {'for _,item in ipairs(items) do -- 古古古'}) - meths.buf_set_lines(0, 10, 12, true, {' end -- ??????????', 'end -- ?古古古古?古古'}) - meths.buf_set_extmark(0, ns, 0, 35, { virt_text={{'A', 'ErrorMsg'}, {'AA'}}, virt_text_pos='overlay'}) - meths.buf_set_extmark(0, ns, 10, 19, { virt_text={{'口口口', 'ErrorMsg'}}, virt_text_pos='overlay'}) - meths.buf_set_extmark(0, ns, 11, 21, { virt_text={{'口口口', 'ErrorMsg'}}, virt_text_pos='overlay'}) - meths.buf_set_extmark(0, ns, 11, 8, { virt_text={{'口口', 'ErrorMsg'}}, virt_text_pos='overlay'}) + 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'}) screen:expect{grid=[[ ^for _,item in ipairs(i| tems) do -- {4:A}AA 古 | @@ -909,7 +909,7 @@ describe('extmark decorations', function() | ]]} - meths.buf_clear_namespace(0, ns, 0, -1) + meths.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) | @@ -931,8 +931,8 @@ describe('extmark decorations', function() screen:try_resize(50, 6) insert(('ab'):rep(100)) for i = 0, 9 do - meths.buf_set_extmark(0, ns, 0, 42 + i, { virt_text={{tostring(i), 'ErrorMsg'}}, virt_text_pos='overlay'}) - meths.buf_set_extmark(0, ns, 0, 91 + i, { virt_text={{tostring(i), 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true}) + 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}) end screen:expect{grid=[[ ababababababababababababababababababababab{4:01234567}| @@ -1028,9 +1028,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.buf_set_lines(0, 0, -1, true, {'-- ' .. ('…'):rep(57)}) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text={{'?????', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true}) - meths.buf_set_extmark(0, ns, 0, 123, { virt_text={{'!!!!!', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true}) + 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}) screen:expect{grid=[[ {4:^?????}……………………………………………………………………………………………………{4:!!!!!}……| {1:~ }| @@ -1083,10 +1083,10 @@ describe('extmark decorations', function() it('overlay virtual text works on and after a TAB #24022', function() screen:try_resize(40, 3) - meths.buf_set_lines(0, 0, -1, true, {'\t\tline 1'}) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Search'}}, virt_text_pos = 'overlay', hl_mode = 'combine' }) - meths.buf_set_extmark(0, ns, 0, 1, { virt_text = {{'BB', 'Search'}}, virt_text_pos = 'overlay', hl_mode = 'combine' }) - meths.buf_set_extmark(0, ns, 0, 2, { virt_text = {{'CC', 'Search'}}, virt_text_pos = 'overlay', hl_mode = 'combine' }) + 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' }) screen:expect{grid=[[ {34:AA} ^ {34:BB} {34:CC}ne 1 | {1:~ }| @@ -1125,13 +1125,13 @@ describe('extmark decorations', function() ]]} command 'hi Blendy guibg=Red blend=30' - meths.buf_set_extmark(0, ns, 1, 5, { virt_text={{'blendy text - here', 'Blendy'}}, virt_text_pos='overlay', hl_mode='blend'}) - meths.buf_set_extmark(0, ns, 2, 5, { virt_text={{'combining color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='combine'}) - meths.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, 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'}) - meths.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.buf_set_extmark(0, ns, 5, 5, { virt_text={{'combining color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='combine', virt_text_hide=true}) - meths.buf_set_extmark(0, ns, 6, 5, { virt_text={{'replacing color', 'Blendy'}}, virt_text_pos='overlay', hl_mode='replace', virt_text_hide=true}) + 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}) screen:expect{grid=[[ {5:^for} _,item {5:in} {6:ipairs}(items) {5:do} | @@ -1190,17 +1190,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.buf_set_extmark(0, ns, 1, 0, { virt_text={{'Very', 'ErrorMsg'}}, virt_text_win_col=31, hl_mode='blend'}) - meths.buf_set_extmark(0, ns, 1, 0, { virt_text={{'VERY', 'ErrorMsg'}}, virt_text_pos='right_align', hl_mode='blend'}) - meths.buf_set_extmark(0, ns, 2, 10, { virt_text={{'Much', 'ErrorMsg'}}, virt_text_win_col=31, hl_mode='blend'}) - meths.buf_set_extmark(0, ns, 2, 10, { virt_text={{'MUCH', 'ErrorMsg'}}, virt_text_pos='right_align', hl_mode='blend'}) - meths.buf_set_extmark(0, ns, 3, 14, { virt_text={{'Error', 'ErrorMsg'}}, virt_text_win_col=31, hl_mode='blend'}) - meths.buf_set_extmark(0, ns, 3, 14, { virt_text={{'ERROR', 'ErrorMsg'}}, virt_text_pos='right_align', hl_mode='blend'}) - meths.buf_set_extmark(0, ns, 7, 21, { virt_text={{'-', 'NonText'}}, virt_text_win_col=4, hl_mode='blend'}) - meths.buf_set_extmark(0, ns, 7, 21, { virt_text={{'-', 'NonText'}}, virt_text_pos='right_align', hl_mode='blend'}) + 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'}) -- empty virt_text should not change anything - meths.buf_set_extmark(0, ns, 8, 0, { virt_text={{''}}, virt_text_win_col=14, hl_mode='blend'}) - meths.buf_set_extmark(0, ns, 8, 0, { virt_text={{''}}, virt_text_pos='right_align', hl_mode='blend'}) + 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'}) screen:expect{grid=[[ ^for _,item in ipairs(items) do | @@ -1294,7 +1294,7 @@ describe('extmark decorations', function() | ]]} - meths.buf_set_extmark(0, ns, 4, 50, { virt_text={{'EOL', 'NonText'}} }) + meths.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}| @@ -1450,7 +1450,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.buf_set_lines(0, 0, -1, false, { string.rep('a', 50) }) + meths.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 50) }) screen:expect{grid=[[ ^aaaaaaaaaaaaaaaaaaaaaaaaa│ | aaaaaaaaaaaaaaaaaaaaaaaaa│{1:~ }| @@ -1459,7 +1459,7 @@ describe('extmark decorations', function() | ]]} local extmark_opts = { virt_text_win_col = 35, virt_text = { { ' ', 'Comment' } } } - meths.buf_set_extmark(0, ns, 0, 0, extmark_opts) + meths.nvim_buf_set_extmark(0, ns, 0, 0, extmark_opts) screen:expect_unchanged() assert_alive() end) @@ -1475,9 +1475,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.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Underlined'}}, hl_mode = 'combine', virt_text_pos = 'overlay' }) - meths.buf_set_extmark(0, ns, 0, 5, { virt_text = {{'BB', 'Underlined'}}, hl_mode = 'combine', virt_text_win_col = 10 }) - meths.buf_set_extmark(0, ns, 0, 2, { virt_text = {{'CC', 'Underlined'}}, hl_mode = 'combine', virt_text_pos = 'right_align' }) + 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' }) screen:expect{grid=[[ {29:AA}{33:- 2 lin}{29:BB}{33:: 11111·····························}{29:CC}| 3333^3 | @@ -1520,9 +1520,9 @@ describe('extmark decorations', function() ddddd eeeee]]) command('windo diffthis') - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Underlined'}}, virt_text_pos = 'overlay' }) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'BB', 'Underlined'}}, virt_text_win_col = 10 }) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'CC', 'Underlined'}}, virt_text_pos = 'right_align' }) + 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' }) screen:expect{grid=[[ {37: }{38:aaaaa }│{37: }{39:------------------------}| {37: }bbbbb │{37: }{28:AA}bbb {28:BB} {28:CC}| @@ -1565,10 +1565,10 @@ describe('extmark decorations', function() {'d', {'BgTwo', 'FgZwei'}}; {'X', {'BgTwo', 'FgZwei', 'VeryBold'}}; } - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'eol' }) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'right_align' }) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 0, 0, { virt_lines = { vt, vt } }) + 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 } }) 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 @@ -1603,7 +1603,7 @@ describe('extmark decorations', function() it('conceal with conceal char #19007', function() screen:try_resize(50, 5) insert('foo\n') - meths.buf_set_extmark(0, ns, 0, 0, {end_col=0, end_row=2, conceal='X'}) + meths.nvim_buf_set_extmark(0, ns, 0, 0, {end_col=0, end_row=2, conceal='X'}) command('set conceallevel=2') screen:expect([[ {26:X} | @@ -1614,13 +1614,13 @@ describe('extmark decorations', function() command('set conceallevel=1') screen:expect_unchanged() - eq("conceal char has to be printable", pcall_err(meths.buf_set_extmark, 0, ns, 0, 0, {end_col=0, end_row=2, conceal='\255'})) + 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'})) end) it('conceal with composed conceal char', function() screen:try_resize(50, 5) insert('foo\n') - meths.buf_set_extmark(0, ns, 0, 0, {end_col=0, end_row=2, conceal='ẍ̲'}) + meths.nvim_buf_set_extmark(0, ns, 0, 0, {end_col=0, end_row=2, conceal='ẍ̲'}) command('set conceallevel=2') screen:expect([[ {26:ẍ̲} | @@ -1632,7 +1632,7 @@ describe('extmark decorations', function() screen:expect_unchanged() -- this is rare, but could happen. Save at least the first codepoint - meths._invalidate_glyph_cache() + meths.nvim__invalidate_glyph_cache() screen:expect{grid=[[ {26:x} | ^ | @@ -1644,7 +1644,7 @@ describe('extmark decorations', function() it('conceal without conceal char #24782', function() screen:try_resize(50, 5) insert('foobar\n') - meths.buf_set_extmark(0, ns, 0, 0, {end_col=3, conceal=''}) + meths.nvim_buf_set_extmark(0, ns, 0, 0, {end_col=3, conceal=''}) command('set listchars=conceal:?') command('let &conceallevel=1') screen:expect([[ @@ -1664,8 +1664,8 @@ describe('extmark decorations', function() it('conceal works just before truncated double-width char #21486', function() screen:try_resize(40, 4) - meths.buf_set_lines(0, 0, -1, true, {'', ('a'):rep(37) .. '<>古'}) - meths.buf_set_extmark(0, ns, 1, 37, {end_col=39, conceal=''}) + 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=''}) command('setlocal conceallevel=2') screen:expect{grid=[[ ^ | @@ -1739,32 +1739,32 @@ describe('extmark decorations', function() [6] = {bold = true, undercurl = true, special = Screen.colors.Red}; }) - meths.buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUL', priority = 20 }) - meths.buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUC', priority = 30 }) + 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 }) screen:expect([[ {1:aaa}{4:bbb}{1:aa^a} | {0:~ }| | ]]) - meths.buf_clear_namespace(0, ns, 0, -1) - meths.buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUC', priority = 20 }) - meths.buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUL', priority = 30 }) + 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 }) screen:expect([[ {2:aaa}{3:bbb}{2:aa^a} | {0:~ }| | ]]) - meths.buf_clear_namespace(0, ns, 0, -1) - meths.buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUL', priority = 30 }) - meths.buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUC', priority = 20 }) + 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 }) screen:expect([[ {1:aaa}{3:bbb}{1:aa^a} | {0:~ }| | ]]) - meths.buf_clear_namespace(0, ns, 0, -1) - meths.buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUC', priority = 30 }) - meths.buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestUL', priority = 20 }) + 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 }) screen:expect([[ {2:aaa}{4:bbb}{2:aa^a} | {0:~ }| @@ -1773,14 +1773,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.buf_clear_namespace(0, ns, 0, -1) + meths.nvim_buf_clear_namespace(0, ns, 0, -1) screen:expect([[ aaabbbaa^a | {0:~ }| | ]]) - meths.buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUL', priority = 25 + d }) - meths.buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestBold', priority = 25 - d }) + 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 }) screen:expect([[ {1:aaa}{5:bbb}{1:aa^a} | {0:~ }| @@ -1788,14 +1788,14 @@ describe('extmark decorations', function() ]]) end for _, d in ipairs({-5, 5}) do - meths.buf_clear_namespace(0, ns, 0, -1) + meths.nvim_buf_clear_namespace(0, ns, 0, -1) screen:expect([[ aaabbbaa^a | {0:~ }| | ]]) - meths.buf_set_extmark(0, ns, 0, 0, { end_col = 9, hl_group = 'TestUC', priority = 25 + d }) - meths.buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestBold', priority = 25 - d }) + 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 }) screen:expect([[ {2:aaa}{6:bbb}{2:aa^a} | {0:~ }| @@ -1812,7 +1812,7 @@ describe('extmark decorations', function() feed('gg') command('set ft=lua') command('syntax on') - meths.buf_set_extmark(0, ns, 0, 0, { end_col = 3, hl_mode = 'combine', hl_group = 'Visual' }) + meths.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 }) @@ -1826,8 +1826,8 @@ describe('extmark decorations', function() it('highlight works after TAB with sidescroll #14201', function() screen:try_resize(50, 3) command('set nowrap') - meths.buf_set_lines(0, 0, -1, true, {'\tword word word word'}) - meths.buf_set_extmark(0, ns, 0, 1, { end_col = 3, hl_group = 'ErrorMsg' }) + 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' }) screen:expect{grid=[[ ^ {4:wo}rd word word word | {1:~ }| @@ -1855,16 +1855,16 @@ describe('extmark decorations', function() it('highlights the beginning of a TAB char correctly #23734', function() screen:try_resize(50, 3) - meths.buf_set_lines(0, 0, -1, true, {'this is the\ttab'}) - meths.buf_set_extmark(0, ns, 0, 11, { end_col = 15, hl_group = 'ErrorMsg' }) + 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' }) screen:expect{grid=[[ ^this is the{4: tab} | {1:~ }| | ]]} - meths.buf_clear_namespace(0, ns, 0, -1) - meths.buf_set_extmark(0, ns, 0, 12, { end_col = 15, hl_group = 'ErrorMsg' }) + meths.nvim_buf_clear_namespace(0, ns, 0, -1) + meths.nvim_buf_set_extmark(0, ns, 0, 12, { end_col = 15, hl_group = 'ErrorMsg' }) screen:expect{grid=[[ ^this is the {4:tab} | {1:~ }| @@ -1874,10 +1874,10 @@ describe('extmark decorations', function() it('highlight applies to a full TAB on line with matches #20885', function() screen:try_resize(50, 3) - meths.buf_set_lines(0, 0, -1, true, {'\t-- match1', ' -- match2'}) + meths.nvim_buf_set_lines(0, 0, -1, true, {'\t-- match1', ' -- match2'}) funcs.matchadd('Underlined', 'match') - meths.buf_set_extmark(0, ns, 0, 0, { end_row = 1, end_col = 0, hl_group = 'Visual' }) - meths.buf_set_extmark(0, ns, 1, 0, { end_row = 2, end_col = 0, hl_group = 'Visual' }) + 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' }) screen:expect{grid=[[ {18: ^ -- }{29:match}{18:1} | {18: -- }{29:match}{18:2} | @@ -1887,8 +1887,8 @@ describe('extmark decorations', function() pending('highlight applies to a full TAB in visual block mode', function() screen:try_resize(50, 8) - meths.buf_set_lines(0, 0, -1, true, {'asdf', '\tasdf', '\tasdf', '\tasdf', 'asdf'}) - meths.buf_set_extmark(0, ns, 0, 0, {end_row = 5, end_col = 0, hl_group = 'Underlined'}) + 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'}) screen:expect([[ {28:^asdf} | {28: asdf} |*3 @@ -1909,7 +1909,7 @@ describe('extmark decorations', function() it('highlight works properly with multibyte text and spell #26771', function() insert('口口\n') screen:try_resize(50, 3) - meths.buf_set_extmark(0, ns, 0, 0, { end_col = 3, hl_group = 'Search' }) + meths.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 3, hl_group = 'Search' }) screen:expect([[ {34:口}口 | ^ | @@ -1928,7 +1928,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.buf_set_extmark(0, ns, i, j, { end_col=j+2, hl_group = 'NonText'}) + meths.nvim_buf_set_extmark(0, ns, i, j, { end_col=j+2, hl_group = 'NonText'}) end end screen:expect{grid=[[ @@ -1960,7 +1960,7 @@ describe('extmark decorations', function() | ]]} - meths.buf_set_extmark(0, ns, 1, 0, { end_line=8, end_col=10, hl_group = 'ErrorMsg'}) + meths.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]} | @@ -1978,7 +1978,7 @@ describe('extmark decorations', function() screen:try_resize(50, 5) insert(example_text) feed'gg' - meths.buf_set_extmark(0, ns, 0, 6, { end_col=13, hl_group = 'NonText', undo_restore=val}) + meths.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) | @@ -1987,7 +1987,7 @@ describe('extmark decorations', function() | ]]} - meths.buf_set_text(0, 0, 4, 0, 8, {''}) + meths.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) | @@ -2025,7 +2025,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.buf_get_extmarks(0, ns, {0,0}, {0, -1}, {details=true})) + meths.nvim_buf_get_extmarks(0, ns, {0,0}, {0, -1}, {details=true})) end) it('virtual text works with rightleft', function() @@ -2033,10 +2033,10 @@ describe('extmark decorations', function() insert('abcdefghijklmn') feed('0') command('set rightleft') - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'EOL', 'Underlined'}}}) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'right_align', 'Underlined'}}, virt_text_pos = 'right_align' }) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'win_col', 'Underlined'}}, virt_text_win_col = 20 }) - meths.buf_set_extmark(0, ns, 0, 2, { virt_text = {{'overlayed', 'Underlined'}}, virt_text_pos = 'overlay' }) + 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' }) screen:expect{grid=[[ {28:ngila_thgir} {28:loc_niw} {28:LOE} nml{28:deyalrevo}b^a| {1: ~}| @@ -2086,7 +2086,7 @@ describe('extmark decorations', function() screen:try_resize(50, 3) insert('abcdefghij口klmnopqrstu口vwx口yz') feed('0') - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'!!!!!', 'Underlined'}}, virt_text_win_col = 11 }) + meths.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:~ }| @@ -2117,7 +2117,7 @@ describe('extmark decorations', function() insert('abcdefghij口klmnopqrstu口vwx口yz') feed('0') command('hi Blendy guibg=Red blend=30') - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{' ! ! ', 'Blendy'}}, virt_text_win_col = 8, hl_mode = 'blend' }) + meths.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:~ }| @@ -2159,10 +2159,10 @@ describe('extmark decorations', function() {1: ~}| | ]]} - meths.buf_set_extmark(0, ns, 0, 2, { virt_text = {{'overlayed', 'Underlined'}}, virt_text_pos = 'overlay' }) - meths.buf_set_extmark(0, ns, 0, 14, { virt_text = {{'古', 'Underlined'}}, virt_text_pos = 'overlay' }) - meths.buf_set_extmark(0, ns, 0, 20, { virt_text = {{'\t', 'Underlined'}}, virt_text_pos = 'overlay' }) - meths.buf_set_extmark(0, ns, 0, 29, { virt_text = {{'古', 'Underlined'}}, virt_text_pos = 'overlay' }) + 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' }) screen:expect{grid=[[ zy {28:古}wv {28: }qpon{28:古}k {28:deyalrevo}b^a| {1: ~}| @@ -2173,7 +2173,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.buf_set_extmark(0, ns, 0, 0, {sign_text='S', sign_hl_group='NonText', hl_group='Error', end_col=14}) + meths.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:~ }| @@ -2183,10 +2183,10 @@ describe('extmark decorations', function() it('virt_text_repeat_linebreak repeats virtual text on wrapped lines', function() screen:try_resize(40, 5) - meths.set_option_value('breakindent', true, {}) + meths.nvim_set_option_value('breakindent', true, {}) insert(example_text) - meths.buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_pos = 'overlay', virt_text_repeat_linebreak = true }) - meths.buf_set_extmark(0, ns, 1, 3, { virt_text = {{'│', 'NonText'}}, virt_text_pos = 'overlay', virt_text_repeat_linebreak = true }) + 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 }) command('norm gg') screen:expect{grid=[[ ^for _,item in ipairs(items) do | @@ -2195,9 +2195,9 @@ describe('extmark decorations', function() if hl_id_cell ~= nil then | | ]]} - meths.buf_clear_namespace(0, ns, 0, -1) - meths.buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_repeat_linebreak = true, virt_text_win_col = 0 }) - meths.buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_repeat_linebreak = true, virt_text_win_col = 2 }) + 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 }) screen:expect{grid=[[ ^for _,item in ipairs(items) do | {1:│} {1:│} local text, hl_id_cell, count = unpa| @@ -2238,7 +2238,7 @@ describe('decorations: inline virtual text', function() [21] = {reverse = true, foreground = Screen.colors.SlateBlue} } - ns = meths.create_namespace 'test' + ns = meths.nvim_create_namespace 'test' end) @@ -2259,7 +2259,7 @@ describe('decorations: inline virtual text', function() | ]]} - meths.buf_set_extmark(0, ns, 1, 14, {virt_text={{': ', 'Special'}, {'string', 'Type'}}, virt_text_pos='inline'}) + meths.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| @@ -2319,9 +2319,9 @@ describe('decorations: inline virtual text', function() | ]]} - meths.buf_set_extmark(0, ns, 0, 5, {virt_text={{''}, {''}}, virt_text_pos='inline'}) - meths.buf_set_extmark(0, ns, 1, 14, {virt_text={{''}, {': ', 'Special'}}, virt_text_pos='inline'}) - meths.buf_set_extmark(0, ns, 1, 48, {virt_text={{''}, {''}}, virt_text_pos='inline'}) + 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'}) screen:expect{grid=[[ ^for _,item in ipairs(items) do | local text{10:: }, hl_id_cell, count = unpack(item)| @@ -2335,7 +2335,7 @@ describe('decorations: inline virtual text', function() | ]]} - meths.buf_set_extmark(0, ns, 1, 14, {virt_text={{''}, {'string', 'Type'}}, virt_text_pos='inline'}) + meths.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} | @@ -2367,8 +2367,8 @@ describe('decorations: inline virtual text', function() it('Normal mode "gM" command works properly', function() command([[call setline(1, '123456789')]]) - meths.buf_set_extmark(0, ns, 0, 2, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 0, 7, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) + 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' }) feed('gM') screen:expect{grid=[[ 12{10:bbb}34^567{10:bbb}89 | @@ -2380,8 +2380,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.buf_set_extmark(0, ns, 0, 40, { virt_text = { { ('b'):rep(10), 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 1, 40, { virt_text = { { ('b'):rep(10), 'Special' } }, virt_text_pos = 'inline' }) + 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' }) screen:expect{grid=[[ ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{10:bbbbbbbbbb}aaaaaaaaaa| aaaaa | @@ -2459,8 +2459,8 @@ describe('decorations: inline virtual text', function() it('cursor positions are correct with multiple inline virtual text', function() insert('12345678') - meths.buf_set_extmark(0, ns, 0, 4, { virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' }) - meths.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' }) + meths.nvim_buf_set_extmark(0, ns, 0, 4, { virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' }) feed '^' feed '4l' screen:expect{grid=[[ @@ -2473,7 +2473,7 @@ describe('decorations: inline virtual text', function() it('adjusts cursor location correctly when inserting around inline virtual text', function() insert('12345678') feed '$' - meths.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' }) screen:expect{grid=[[ 1234{10: virtual text }567^8 | @@ -2484,7 +2484,7 @@ describe('decorations: inline virtual text', function() it('has correct highlighting with multi-byte characters', function() insert('12345678') - meths.buf_set_extmark(0, ns, 0, 4, { virt_text = { { 'múlti-byté chñröcters 修补', 'Special' } }, virt_text_pos = 'inline' }) + meths.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 | @@ -2495,7 +2495,7 @@ describe('decorations: inline virtual text', function() it('has correct cursor position when inserting around virtual text', function() insert('12345678') - meths.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' }) feed '^' feed '3l' feed 'a' @@ -2521,7 +2521,7 @@ describe('decorations: inline virtual text', function() end) it('has correct cursor position with virtual text on an empty line', function() - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + meths.nvim_buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ {10:^virtual text} | {1:~ }| @@ -2535,8 +2535,8 @@ describe('decorations: inline virtual text', function() call setline(1, ['', 'aaa', '', 'bbbbbb']) normal gg0 ]]) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('X', 60), 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 2, 0, { virt_text = { { string.rep('X', 61), 'Special' } }, virt_text_pos = 'inline' }) + 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' }) feed('$') screen:expect{grid=[[ {10:^XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}| @@ -2626,7 +2626,7 @@ describe('decorations: inline virtual text', function() feed('<TAB>') feed('test') feed('<ESC>') - meths.buf_set_extmark(0, ns, 0, 1, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + meths.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 | @@ -2667,7 +2667,7 @@ describe('decorations: inline virtual text', function() command('set linebreak') insert('one twoword') feed('0') - meths.buf_set_extmark(0, ns, 0, 3, { virt_text = { { ': virtual text', 'Special' } }, virt_text_pos = 'inline' }) + meths.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:~ }| @@ -2678,10 +2678,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.buf_set_extmark(0, ns, 0, 9, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 0, 9, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.buf_set_extmark(0, ns, 1, 9, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.buf_set_extmark(0, ns, 1, 9, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) + 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' }) screen:expect{grid=[[ ^foo foo f{10:AAABBB}oo bar | foo foo f{10:CCCDDD}oo bar | @@ -2695,7 +2695,7 @@ describe('decorations: inline virtual text', function() /foo^ | ]]} - meths.buf_set_extmark(0, ns, 0, 13, { virt_text = { { 'EEE', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + meths.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 | @@ -2707,10 +2707,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.buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.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, 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' }) feed('8l') screen:expect{grid=[[ foo foo {10:AAABBB}^foo bar | @@ -2726,7 +2726,7 @@ describe('decorations: inline virtual text', function() {8:-- VISUAL BLOCK --} | ]]} - meths.buf_set_extmark(0, ns, 0, 10, { virt_text = { { 'EEE', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + meths.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 | @@ -2736,12 +2736,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.buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'DDD', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) - meths.buf_set_extmark(0, ns, 0, 4, { end_col = 11, hl_group = 'Search' }) - meths.buf_set_extmark(0, ns, 1, 4, { end_col = 11, hl_group = 'Search' }) + 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' }) screen:expect{grid=[[ foo {12:foo }{10:AAA}{19:BBB}{12:foo} bar | foo {12:foo }{19:CCC}{10:DDD}{12:foo} ba^r | @@ -2751,10 +2751,10 @@ describe('decorations: inline virtual text', function() it('inside highlight range of syntax', function() insert('foo foo foo bar\nfoo foo foo bar') - meths.buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'AAA', 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'BBB', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.buf_set_extmark(0, ns, 1, 8, { virt_text = { { 'CCC', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.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, 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' }) command([[syntax match Search 'foo \zsfoo foo\ze bar']]) screen:expect{grid=[[ foo {12:foo }{10:AAA}{19:BBB}{12:foo} bar | @@ -2766,7 +2766,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.buf_set_extmark(0, ns, 0, 8, { virt_text = { { ('>'):rep(43), 'Special' } }, virt_text_pos = 'inline', right_gravity = false }) + meths.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=[[ @@ -2837,8 +2837,8 @@ describe('decorations: inline virtual text', function() screen:try_resize(30, 4) command('setlocal showbreak=+ breakindent breakindentopt=shift:2') insert(('a'):rep(15)) - meths.buf_set_extmark(0, ns, 0, 8, { virt_text = {{ ('>'):rep(32), 'Special' }}, virt_text_pos = 'inline', right_gravity = false }) - meths.buf_set_extmark(0, ns, 0, 8, { virt_text = {{ ('<'):rep(32), 'Special' }}, virt_text_pos = 'inline', right_gravity = true }) + 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 }) feed('08l') screen:expect{grid=[[ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>>>>}| @@ -2935,8 +2935,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.buf_set_extmark(0, ns, 0, 50, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 0, 2, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + 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' }) feed('$') screen:expect{grid=[[ opqrstuvwxyzabcdefghijklmnopqrstuvwx{10:virtual text}y^z| @@ -2948,7 +2948,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.buf_set_extmark(0, ns, 0, 2, { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) + meths.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| @@ -2960,7 +2960,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.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('a', 55), 'Special' } }, virt_text_pos = 'inline' }) feed('gg$') screen:expect{grid=[[ {10:aaaaaaaaaaaaaaaaaaaaaaaaa}test ^a | @@ -2972,7 +2972,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.buf_set_extmark(0, ns, 0, 3, { virt_text = { { string.rep('X', 50), 'Special' } }, virt_text_pos = 'inline' }) + meths.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| @@ -2984,7 +2984,7 @@ describe('decorations: inline virtual text', function() it('hidden virtual text does not interfere with Visual highlight', function() insert('abcdef') command('set nowrap') - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'XXX', 'Special' } }, virt_text_pos = 'inline' }) + meths.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 | @@ -3011,7 +3011,7 @@ describe('decorations: inline virtual text', function() test test]]) command('set number') - meths.buf_set_extmark(0, ns, 0, 1, { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) + meths.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}| @@ -3024,7 +3024,7 @@ describe('decorations: inline virtual text', function() it('highlighting is correct when virtual text is proceeded with a match', function() insert([[test]]) - meths.buf_set_extmark(0, ns, 0, 2, { 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' }) feed('gg0') command('match ErrorMsg /e/') screen:expect{grid=[[ @@ -3042,7 +3042,7 @@ describe('decorations: inline virtual text', function() it('smoothscroll works correctly when virtual text wraps', function() insert('foobar') - meths.buf_set_extmark(0, ns, 0, 3, { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' }) + meths.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}| @@ -3068,9 +3068,9 @@ describe('decorations: inline virtual text', function() ]]) insert('aaa\tbbb') command("set diff") - meths.buf_set_extmark(0, ns, 0, 1, { virt_text = { { 'test', 'Special' } }, virt_text_pos = 'inline', right_gravity = false }) - meths.buf_set_extmark(0, ns, 5, 0, { virt_text = { { '!', 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 5, 3, { virt_text = { { '' } }, virt_text_pos = 'inline' }) + 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' }) command("vnew") insert([[ 000 @@ -3109,8 +3109,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.buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('a', 55), 'Special' } }, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('b', 55), 'Special' } }, virt_text_pos = 'inline' }) + 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' }) feed('$') screen:expect{grid=[[ {10:bbbbbbbbbbbbbbbbbbbbbbbbb}^a | @@ -3122,7 +3122,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.buf_set_extmark( 0, ns, 0, 0, { virt_text = { { string.rep('a', 60), 'Special' } }, virt_text_pos = 'inline' }) + meths.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 | @@ -3140,8 +3140,8 @@ describe('decorations: inline virtual text', function() bbbbb ccccc]]) - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'foo'}}, virt_text_pos = 'inline' }) - meths.buf_set_extmark(0, ns, 2, 0, { virt_text = {{'bar'}}, virt_text_pos = 'inline' }) + 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' }) screen:expect{grid=[[ fooaaaaa | bbbbb | @@ -3183,7 +3183,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.buf_set_extmark(0, ns, 0, 0, {virt_text = {{('a'):rep(82)}, {'b'}}, virt_text_pos = 'inline'}) + meths.nvim_buf_set_extmark(0, ns, 0, 0, {virt_text = {{('a'):rep(82)}, {'b'}}, virt_text_pos = 'inline'}) screen:expect{grid=[[ ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| b | @@ -3217,7 +3217,7 @@ describe('decorations: inline virtual text', function() setlocal nowrap list listchars=extends:! call setline(1, repeat('a', 51)) ]]) - meths.buf_set_extmark(0, ns, 0, 50, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) + meths.nvim_buf_set_extmark(0, ns, 0, 50, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) feed('20l') screen:expect{grid=[[ aaaaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:!}| @@ -3254,7 +3254,7 @@ describe('decorations: inline virtual text', function() command('set nowrap') command('set list') command('set listchars+=extends:c') - meths.buf_set_extmark(0, ns, 0, 0, { virt_text = { { 'test', 'Special' } }, virt_text_pos = 'inline' }) + meths.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=[[ @@ -3267,8 +3267,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.buf_set_extmark(0, ns, 1, 1, { virt_text = { { '-口-', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) - meths.buf_set_extmark(0, ns, 2, 2, { virt_text = { { '口', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'replace' }) + 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' }) feed('gg0') screen:expect{grid=[[ ^123456789 | @@ -3337,8 +3337,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.buf_set_extmark(0, ns, 1, 1, { virt_text = { { '-口-', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) - meths.buf_set_extmark(0, ns, 2, 2, { virt_text = { { '口', 'Special' } }, virt_text_pos = 'inline', hl_mode = 'combine' }) + 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' }) feed('gg0') screen:expect{grid=[[ ^123456789 | @@ -3413,7 +3413,7 @@ describe('decorations: inline virtual text', function() call setline(1, repeat('a', 28)) normal! $ ]]) - meths.buf_set_extmark(0, ns, 0, 27, { virt_text = { { ('123'):rep(23) } }, virt_text_pos = 'inline' }) + meths.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| @@ -3626,7 +3626,7 @@ describe('decorations: inline virtual text', function() call setline(1, repeat("\t", 4) .. 'a') normal! $ ]]) - meths.buf_set_extmark(0, ns, 0, 3, { virt_text = { { ('12'):rep(32) } }, virt_text_pos = 'inline' }) + meths.nvim_buf_set_extmark(0, ns, 0, 3, { virt_text = { { ('12'):rep(32) } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ {1:<------><------><------>}121212| 121212121212121212121212121212| @@ -3722,7 +3722,7 @@ describe('decorations: inline virtual text', function() call setline(1, repeat('a', 50) .. ' ' .. repeat('c', 45)) normal! $ ]]) - meths.buf_set_extmark(0, ns, 0, 50, { virt_text = { { ('b'):rep(10) } }, virt_text_pos = 'inline' }) + meths.nvim_buf_set_extmark(0, ns, 0, 50, { virt_text = { { ('b'):rep(10) } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {1:+}bbbbbbbbbb | @@ -3745,7 +3745,7 @@ describe('decorations: inline virtual text', function() call setline(1, repeat('a', 40) .. '口' .. '12345') normal! $ ]]) - meths.buf_set_extmark(0, ns, 0, 40, { virt_text = { { ('b'):rep(9) } }, virt_text_pos = 'inline' }) + meths.nvim_buf_set_extmark(0, ns, 0, 40, { virt_text = { { ('b'):rep(9) } }, virt_text_pos = 'inline' }) screen:expect{grid=[[ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbb{1:>}| 口1234^5 | @@ -3772,7 +3772,7 @@ describe('decorations: virtual lines', function() [9] = {foreground = Screen.colors.Brown}; } - ns = meths.create_namespace 'test' + ns = meths.nvim_create_namespace 'test' end) local example_text2 = [[ @@ -3788,7 +3788,7 @@ if (h->n_buckets < new_n_buckets) { // expand it('works with one line', function() insert(example_text2) feed 'gg' - meths.buf_set_extmark(0, ns, 1, 33, { + meths.nvim_buf_set_extmark(0, ns, 1, 33, { virt_lines={ {{">> ", "NonText"}, {"krealloc", "Identifier"}, {": change the size of an allocation"}}}; virt_lines_above=true; }) @@ -3857,7 +3857,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.buf_set_extmark(0, ns, 5, 0, { + meths.nvim_buf_set_extmark(0, ns, 5, 0, { virt_lines = { {{"^^ REVIEW:", "Todo"}, {" new_vals variable seems unnecessary?", "Comment"}} }; }) -- TODO: what about the cursor?? @@ -3876,7 +3876,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.buf_clear_namespace(0, ns, 0, -1) + meths.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 | @@ -3913,7 +3913,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.buf_set_extmark(0, ns, 0, 0, { + meths.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"}}; @@ -3974,7 +3974,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - local id = meths.buf_set_extmark(0, ns, 7, 0, { + local id = meths.nvim_buf_set_extmark(0, ns, 7, 0, { virt_lines={{{"Grugg"}}}; right_gravity=false; }) @@ -4057,7 +4057,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.buf_del_extmark(0, ns, id) + meths.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 *)| @@ -4093,7 +4093,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - local id = meths.buf_set_extmark(0, ns, 8, 0, { + local id = meths.nvim_buf_set_extmark(0, ns, 8, 0, { virt_lines={{{"Grugg"}}}; virt_lines_above = true, }) @@ -4151,7 +4151,7 @@ if (h->n_buckets < new_n_buckets) { // expand --No lines in buffer-- | ]]} - meths.buf_del_extmark(0, ns, id) + meths.nvim_buf_del_extmark(0, ns, id) screen:expect{grid=[[ ^ | {1:~ }|*10 @@ -4163,7 +4163,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.buf_set_extmark(0, ns, 0, 0, {virt_lines = {{{'bar', 'Comment'}}}}) + meths.nvim_buf_set_extmark(0, ns, 0, 0, {virt_lines = {{{'bar', 'Comment'}}}}) screen:expect([[ fo^o | {6:bar} | @@ -4177,7 +4177,7 @@ if (h->n_buckets < new_n_buckets) { // expand insert("aa\nbb\ncc\ndd\nee\nff\ngg\nhh") feed 'gg' - meths.buf_set_extmark(0, ns, 6, 0, { + meths.nvim_buf_set_extmark(0, ns, 6, 0, { virt_lines={ {{"they see me"}}; {{"scrolling", "Special"}}; @@ -4327,7 +4327,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - local markid = meths.buf_set_extmark(0, ns, 2, 0, { + local markid = meths.nvim_buf_set_extmark(0, ns, 2, 0, { virt_lines={ {{"Some special", "Special"}}; {{"remark about codes", "Comment"}}; @@ -4349,7 +4349,7 @@ if (h->n_buckets < new_n_buckets) { // expand | ]]} - meths.buf_set_extmark(0, ns, 2, 0, { + meths.nvim_buf_set_extmark(0, ns, 2, 0, { virt_lines={ {{"Some special", "Special"}}; {{"remark about codes", "Comment"}}; @@ -4377,7 +4377,7 @@ if (h->n_buckets < new_n_buckets) { // expand it('works with hard TABs', function() insert(example_text2) feed 'gg' - meths.buf_set_extmark(0, ns, 1, 0, { + meths.nvim_buf_set_extmark(0, ns, 1, 0, { virt_lines={ {{">>", "NonText"}, {"\tvery\ttabby", "Identifier"}, {"text\twith\ttabs"}}}; }) screen:expect{grid=[[ @@ -4451,8 +4451,8 @@ if (h->n_buckets < new_n_buckets) { // expand bbb ccc ddd]]) - meths.buf_set_extmark(0, ns, 0, 0, {end_row = 2, virt_lines = {{{'VIRT LINE 1', 'NonText'}}}}) - meths.buf_set_extmark(0, ns, 3, 0, {end_col = 2, virt_lines = {{{'VIRT LINE 2', 'NonText'}}}}) + 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'}}}}) screen:expect{grid=[[ aaa | {1:VIRT LINE 1} | @@ -4473,8 +4473,8 @@ if (h->n_buckets < new_n_buckets) { // expand ccc ddd]]) command('set number rightleft') - meths.buf_set_extmark(0, ns, 0, 0, {virt_lines = {{{'VIRT LINE 1', 'NonText'}}}, virt_lines_leftcol = true}) - meths.buf_set_extmark(0, ns, 3, 0, {virt_lines = {{{'VIRT LINE 2', 'NonText'}}}}) + 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'}}}}) screen:expect{grid=[[ aaa{9: 1 }| {1:1 ENIL TRIV}| @@ -4494,7 +4494,7 @@ if (h->n_buckets < new_n_buckets) { // expand line3 line4 line5]]) - meths.buf_set_extmark(0, ns, 0, 0, {virt_lines={{{"foo"}}, {{"bar"}}, {{"baz"}}}}) + meths.nvim_buf_set_extmark(0, ns, 0, 0, {virt_lines={{{"foo"}}, {{"bar"}}, {{"baz"}}}}) screen:expect{grid=[[ line1 | foo | @@ -4551,8 +4551,8 @@ describe('decorations: signs', function() [3] = {background = Screen.colors.Yellow1, foreground = Screen.colors.Blue1}; } - ns = meths.create_namespace 'test' - meths.set_option_value('signcolumn', 'auto:9', {}) + ns = meths.nvim_create_namespace 'test' + meths.nvim_set_option_value('signcolumn', 'auto:9', {}) end) local example_test3 = [[ @@ -4567,7 +4567,7 @@ l5 insert(example_test3) feed 'gg' - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S'}) + meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S'}) screen:expect{grid=[[ {1: }^l1 | @@ -4585,7 +4585,7 @@ l5 insert(example_test3) feed 'gg' - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row=1}) + meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row=1}) screen:expect{grid=[[ {1: }^l1 | @@ -4603,7 +4603,7 @@ l5 insert(example_test3) feed 'gg' - meths.buf_set_extmark(0, ns, 1, 0, {sign_text='S', hl_group='Todo', end_col=1}) + meths.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 | @@ -4615,14 +4615,14 @@ l5 | ]]} - meths.buf_clear_namespace(0, ns, 0, -1) + meths.nvim_buf_clear_namespace(0, ns, 0, -1) end) it('can add multiple signs (single extmark)', function() insert(example_test3) feed 'gg' - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row = 2}) + meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row = 2}) screen:expect{grid=[[ {1: }^l1 | @@ -4640,8 +4640,8 @@ l5 insert(example_test3) feed'gg' - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S1'}) - meths.buf_set_extmark(0, ns, 3, -1, {sign_text='S2', end_row = 4}) + 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}) screen:expect{grid=[[ {1: }^l1 | @@ -4659,8 +4659,8 @@ l5 insert(example_test3) feed 'gg' - meths.buf_set_extmark(0, ns, 3, -1, {sign_text='S1'}) - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row = 3}) + 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}) screen:expect{grid=[[ {1: }^l1 | S2{1: }l2 | @@ -4678,8 +4678,8 @@ l5 insert(example_test3) feed 'gg' - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S1', end_row=2}) - meths.buf_set_extmark(0, ns, 2, -1, {sign_text='S2', end_row=3}) + 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}) screen:expect{grid=[[ {1: }^l1 | @@ -4697,8 +4697,8 @@ l5 insert(example_test3) feed 'gg' - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=0}) - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row=1}) + 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}) screen:expect{grid=[[ S1^l1 | @@ -4719,10 +4719,10 @@ l5 helpers.command('sign define Oldsign text=x') helpers.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]]) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1'}) - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S2'}) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S4'}) - meths.buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) + 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'}) screen:expect{grid=[[ S1S4^l1 | @@ -4743,11 +4743,11 @@ l5 helpers.command('sign define Oldsign text=x') helpers.command([[exe 'sign place 42 line=2 name=Oldsign buffer=' . bufnr('')]]) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1'}) - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S2'}) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S3', end_row = 4}) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S4'}) - meths.buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) + 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'}) screen:expect{grid=[[ S1S3S4^l1 | @@ -4767,7 +4767,7 @@ l5 feed 'gg' feed '2<C-e>' - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='X', end_row=3}) + meths.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='X', end_row=3}) screen:expect{grid=[[ X {1: }^l3 | @@ -4784,18 +4784,18 @@ l5 command 'normal 10oa b c d e f g h' for i = 1, 10 do - meths.buf_set_extmark(0, ns, i, 0, { end_col = 1, hl_group='Todo' }) - meths.buf_set_extmark(0, ns, i, 2, { end_col = 3, hl_group='Todo' }) - meths.buf_set_extmark(0, ns, i, 4, { end_col = 5, hl_group='Todo' }) - meths.buf_set_extmark(0, ns, i, 6, { end_col = 7, hl_group='Todo' }) - meths.buf_set_extmark(0, ns, i, 8, { end_col = 9, hl_group='Todo' }) - meths.buf_set_extmark(0, ns, i, 10, { end_col = 11, hl_group='Todo' }) - meths.buf_set_extmark(0, ns, i, 12, { end_col = 13, hl_group='Todo' }) - meths.buf_set_extmark(0, ns, i, 14, { end_col = 15, hl_group='Todo' }) - meths.buf_set_extmark(0, ns, i, -1, { sign_text='W' }) - meths.buf_set_extmark(0, ns, i, -1, { sign_text='X' }) - meths.buf_set_extmark(0, ns, i, -1, { sign_text='Y' }) - meths.buf_set_extmark(0, ns, i, -1, { sign_text='Z' }) + 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' }) end screen:expect{grid=[[ @@ -4813,10 +4813,10 @@ l5 command('sign define Oldsign text=O3') command([[exe 'sign place 42 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]]) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S4', priority=100}) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S2', priority=5}) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200}) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1}) + 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}) screen:expect{grid=[[ S1S2O3S4S5^l1 | @@ -4825,7 +4825,7 @@ l5 ]]} -- Check truncation works too - meths.set_option_value('signcolumn', 'auto', {}) + meths.nvim_set_option_value('signcolumn', 'auto', {}) screen:expect{grid=[[ S5^l1 | @@ -4854,10 +4854,10 @@ l5 | ]]} - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1}) + meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1}) screen:expect_unchanged() - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200}) + meths.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200}) screen:expect{grid=[[ O3O3O3O3O3O3O3O3S5^ | {2:~ }| @@ -4869,10 +4869,10 @@ l5 it('does not set signcolumn for signs without text', function() screen:try_resize(20, 3) - meths.set_option_value('signcolumn', 'auto', {}) + meths.nvim_set_option_value('signcolumn', 'auto', {}) insert(example_test3) feed 'gg' - meths.buf_set_extmark(0, ns, 0, -1, {number_hl_group='Error'}) + meths.nvim_buf_set_extmark(0, ns, 0, -1, {number_hl_group='Error'}) screen:expect{grid=[[ ^l1 | l2 | @@ -4883,9 +4883,9 @@ l5 it('correct width when removing multiple signs from sentinel line', function() screen:try_resize(20, 4) insert(example_test3) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=3}) - meths.buf_set_extmark(0, ns, 1, -1, {invalidate = true, sign_text='S2'}) - meths.buf_set_extmark(0, ns, 1, -1, {invalidate = true, sign_text='S3'}) + 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'}) feed('2Gdd') screen:expect{grid=[[ @@ -4899,8 +4899,8 @@ l5 it('correct width with multiple overlapping signs', function() screen:try_resize(20, 4) insert(example_test3) - meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=2}) - meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row=2}) + 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}) feed('gg') screen:expect{grid=[[ @@ -4935,9 +4935,9 @@ describe('decorations: virt_text', function() command 'normal 4ohello' command 'normal aVIRTUAL' - local ns = meths.create_namespace('test') + local ns = meths.nvim_create_namespace('test') - meths.buf_set_extmark(0, ns, 2, 0, { + meths.nvim_buf_set_extmark(0, ns, 2, 0, { virt_text = {{"hello", "String"}}, virt_text_win_col = 20, }) @@ -4977,9 +4977,9 @@ describe('decorations: virt_text', function() | ]]} - local ns = meths.create_namespace('ns') + local ns = meths.nvim_create_namespace('ns') for row = 1, 5 do - meths.buf_set_extmark(0, ns, row, 0, { id = 1, virt_text = {{'world', 'Normal'}} }) + meths.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 e208385e92..0c9ca6199b 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -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.get_current_buf() + local buf = meths.nvim_get_current_buf() command('botright new') screen:expect { grid = [[ @@ -1071,7 +1071,7 @@ AAAB]] ]], } - meths.buf_set_lines(buf, 1, 2, true, { 'BBB' }) + meths.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.get_current_buf() + local buf = meths.nvim_get_current_buf() command('botright split | diffoff') screen:expect { grid = [[ @@ -1115,7 +1115,7 @@ AAAB]] ]], } - meths.buf_set_lines(buf, 1, 2, true, { 'BBB' }) + meths.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.get_option_value('foldcolumn', {})) + eq('0', meths.nvim_get_option_value('foldcolumn', {})) command('diffsplit | bd') screen:expect([[ ^ | {0:~ }|*4 | ]]) - eq('0', meths.get_option_value('foldcolumn', {})) + eq('0', meths.nvim_get_option_value('foldcolumn', {})) end) -- oldtest: Test_diff_binary() diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 6febb2e2df..645cce25aa 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -30,9 +30,9 @@ 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.open_win(0, true, {width=10, height=10, relative='editor', row=0, col=0}) + meths.nvim_open_win(0, true, {width=10, height=10, relative='editor', row=0, col=0}) eq(1002, funcs.win_getid()) - eq('editor', meths.win_get_config(1002).relative) + eq('editor', meths.nvim_win_get_config(1002).relative) command([[ call nvim_win_close(1001, v:false) wincmd j @@ -41,9 +41,9 @@ describe('float window', function() end) it('win_execute() should work' , function() - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {'the floatwin', 'abc', 'def'}) - local win = meths.open_win(buf, false, {relative='win', width=16, height=1, row=0, col=10}) + 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)') eq('\nthe floatwin', line) eq('\n1', funcs.win_execute(win, 'echo line(".",'..win.id..')')) @@ -54,9 +54,9 @@ describe('float window', function() it("win_execute() call commands that are not allowed when 'hidden' is not set" , function() command('set nohidden') - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {'the floatwin'}) - local win = meths.open_win(buf, true, {relative='win', width=16, height=1, row=0, col=10}) + 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!') @@ -192,7 +192,7 @@ describe('float window', function() end) it('opened with correct position relative to the mouse', function() - meths.input_mouse('left', 'press', '', 0, 10, 10) + meths.nvim_input_mouse('left', 'press', '', 0, 10, 10) local pos = exec_lua([[ local bufnr = vim.api.nvim_create_buf(false, true) @@ -479,67 +479,67 @@ describe('float window', function() it('no crash with bufpos and non-existent window', function() command('new') - local closed_win = meths.get_current_win().id + local closed_win = meths.nvim_get_current_win().id command('close') - local buf = meths.create_buf(false,false) - meths.open_win(buf, true, {relative='win', win=closed_win, width=1, height=1, bufpos={0,0}}) + 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}}) 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.open_win(0, true, float_opts) - meths.set_option_value('fillchars', NIL, {win=float_win.id}) + local float_win = meths.nvim_open_win(0, true, float_opts) + meths.nvim_set_option_value('fillchars', NIL, {win=float_win.id}) float_opts.style = 'minimal' - meths.win_set_config(float_win, float_opts) + meths.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.open_win(0, true, float_opts) - meths.set_option_value('number', true, { win = float_win }) + local float_win = meths.nvim_open_win(0, true, float_opts) + meths.nvim_set_option_value('number', true, { win = float_win }) float_opts.row = 2 - meths.win_set_config(float_win, float_opts) - eq(false, meths.get_option_value('number', { win = float_win })) + meths.nvim_win_set_config(float_win, float_opts) + eq(false, meths.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.open_win(0, true, float_opts) - meths.set_option_value('number', true, { win = float_win }) + local float_win = meths.nvim_open_win(0, true, float_opts) + meths.nvim_set_option_value('number', true, { win = float_win }) float_opts.row = 2 float_opts.style = nil - meths.win_set_config(float_win, float_opts) - eq(true, meths.get_option_value('number', { win = float_win })) + meths.nvim_win_set_config(float_win, float_opts) + eq(true, meths.nvim_get_option_value('number', { win = float_win })) end) it("'scroll' is computed correctly when opening float with splitkeep=screen #20684", function() - meths.set_option_value('splitkeep', 'screen', {}) + meths.nvim_set_option_value('splitkeep', 'screen', {}) local float_opts = {relative = 'editor', row = 1, col = 1, width = 10, height = 10} - local float_win = meths.open_win(0, true, float_opts) - eq(5, meths.get_option_value('scroll', {win=float_win.id})) + local float_win = meths.nvim_open_win(0, true, float_opts) + eq(5, meths.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.open_win(0, false, float_opts) - meths.open_win(0, false, float_opts) - eq(3, #meths.list_wins()) + meths.nvim_open_win(0, false, float_opts) + meths.nvim_open_win(0, false, float_opts) + eq(3, #meths.nvim_list_wins()) command('unhide') - eq({ w0 }, meths.list_wins()) + eq({ w0 }, meths.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.open_win(0, false, float_opts) - meths.open_win(0, false, float_opts) - eq(3, #meths.list_wins()) + meths.nvim_open_win(0, false, float_opts) + meths.nvim_open_win(0, false, float_opts) + eq(3, #meths.nvim_list_wins()) command('all') - eq({ w0 }, meths.list_wins()) + eq({ w0 }, meths.nvim_list_wins()) end) describe('with only one tabpage,', function() @@ -552,37 +552,37 @@ describe('float window', function() end) describe('closing the last non-floating window gives E444', function() before_each(function() - meths.open_win(old_buf, true, float_opts) + meths.nvim_open_win(old_buf, true, float_opts) end) it('if called from non-floating window', function() - meths.set_current_win(old_win) + meths.nvim_set_current_win(old_win) eq('Vim:E444: Cannot close last window', - pcall_err(meths.win_close, old_win, false)) + pcall_err(meths.nvim_win_close, old_win, false)) end) it('if called from floating window', function() eq('Vim:E444: Cannot close last window', - pcall_err(meths.win_close, old_win, false)) + pcall_err(meths.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.open_win(old_buf, false, float_opts).id + same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() eq(old_win, curwin().id) expect('') - eq(1, #meths.list_wins()) + eq(1, #meths.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.buf_delete(old_buf, {force = true}) + meths.nvim_buf_delete(old_buf, {force = true}) end) it('if called from floating window', function() - meths.set_current_win(same_buf_float) + meths.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.buf_delete(old_buf, {force = true}) + meths.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, eval('g:win_leave')) eq(old_win, eval('g:win_enter')) end) @@ -590,67 +590,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.open_win(old_buf, false, float_opts).id - other_buf = meths.create_buf(true, false).id - other_buf_float = meths.open_win(other_buf, true, float_opts).id + 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 insert('bar') - meths.set_current_win(old_win) + meths.nvim_set_current_win(old_win) end) after_each(function() eq(other_buf, curbuf().id) expect('bar') - eq(2, #meths.list_wins()) + eq(2, #meths.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.buf_delete(old_buf, {force = true}) + meths.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.set_current_win(same_buf_float) + meths.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.buf_delete(old_buf, {force = true}) + meths.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.set_current_win(other_buf_float) - meths.buf_delete(old_buf, {force = true}) + meths.nvim_set_current_win(other_buf_float) + meths.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.open_win(old_buf, false, float_opts).id - local unlisted_buf = meths.create_buf(true, false).id - unlisted_buf_float = meths.open_win(unlisted_buf, true, float_opts).id + 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 insert('unlisted') command('set nobuflisted') - meths.set_current_win(old_win) + meths.nvim_set_current_win(old_win) end) after_each(function() expect('') - eq(2, #meths.list_wins()) + eq(2, #meths.nvim_list_wins()) end) it('if called from non-floating window', function() - meths.buf_delete(old_buf, {force = true}) + meths.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.set_current_win(same_buf_float) + meths.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.buf_delete(old_buf, {force = true}) + meths.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.set_current_win(unlisted_buf_float) - meths.buf_delete(old_buf, {force = true}) + meths.nvim_set_current_win(unlisted_buf_float) + meths.nvim_buf_delete(old_buf, {force = true}) end) end) end) @@ -661,20 +661,20 @@ describe('float window', function() command('botright vnew') insert('unlisted') command('set nobuflisted') - meths.set_current_win(old_win) - same_buf_float = meths.open_win(old_buf, false, float_opts).id + meths.nvim_set_current_win(old_win) + same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() expect('') - eq(2, #meths.list_wins()) + eq(2, #meths.nvim_list_wins()) end) it('if called from non-floating window with the deleted buffer', function() - meths.buf_delete(old_buf, {force = true}) + meths.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.set_current_win(same_buf_float) - meths.buf_delete(old_buf, {force = true}) + meths.nvim_set_current_win(same_buf_float) + meths.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, curwin().id) end) end) @@ -696,28 +696,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.set_current_win(old_win) - same_buf_float = meths.open_win(old_buf, false, float_opts).id + meths.nvim_set_current_win(old_win) + same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() expect('') - eq(2, #meths.list_wins()) - eq(2, #meths.list_tabpages()) + eq(2, #meths.nvim_list_wins()) + eq(2, #meths.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.buf_delete(old_buf, {force = true}) + meths.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.list_tabpages()) - meths.buf_delete(old_buf, {force = true}) + eq(3, #meths.nvim_list_tabpages()) + meths.nvim_buf_delete(old_buf, {force = true}) end) it('if called from floating window with the same buffer', function() - meths.set_current_win(same_buf_float) + meths.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.buf_delete(old_buf, {force = true}) + meths.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) @@ -727,22 +727,22 @@ describe('float window', function() local same_buf_float before_each(function() command('botright vsplit') - meths.set_current_buf(unlisted_buf) - meths.set_current_win(old_win) - same_buf_float = meths.open_win(old_buf, false, float_opts).id + 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 end) after_each(function() expect('') - eq(3, #meths.list_wins()) - eq(2, #meths.list_tabpages()) + eq(3, #meths.nvim_list_wins()) + eq(2, #meths.nvim_list_tabpages()) end) it('if called from non-floating window with the deleted buffer', function() - meths.buf_delete(old_buf, {force = true}) + meths.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.set_current_win(same_buf_float) - meths.buf_delete(old_buf, {force = true}) + meths.nvim_set_current_win(same_buf_float) + meths.nvim_buf_delete(old_buf, {force = true}) eq(same_buf_float, curwin().id) end) end) @@ -762,38 +762,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.open_win(old_buf, false, float_opts).id + same_buf_float = meths.nvim_open_win(old_buf, false, float_opts).id end) after_each(function() eq(old_tabpage, curtab().id) expect('oldtab') - eq(1, #meths.list_tabpages()) + eq(1, #meths.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.win_close(old_win, false) + meths.nvim_win_close(old_win, false) end) it('if called from floating window', function() - meths.set_current_win(same_buf_float) - meths.win_close(old_win, false) + meths.nvim_set_current_win(same_buf_float) + meths.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.create_buf(true, false).id - other_buf_float = meths.open_win(other_buf, true, float_opts).id + local other_buf = meths.nvim_create_buf(true, false).id + other_buf_float = meths.nvim_open_win(other_buf, true, float_opts).id insert('foo') - meths.set_current_win(old_win) + meths.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.win_close, old_win, false)) + pcall_err(meths.nvim_win_close, old_win, false)) end) it('if called from floating window', function() - meths.set_current_win(other_buf_float) + meths.nvim_set_current_win(other_buf_float) eq('Vim:E5601: Cannot close window, only floating window would remain', - pcall_err(meths.win_close, old_win, false)) + pcall_err(meths.nvim_win_close, old_win, false)) end) end) end) @@ -801,27 +801,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.open_win(old_buf, false, float_opts).id - other_buf = meths.create_buf(true, false).id - other_buf_float = meths.open_win(other_buf, true, float_opts).id - meths.set_current_win(old_win) + 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) end) after_each(function() eq(old_tabpage, curtab().id) expect('oldtab') - eq(1, #meths.list_tabpages()) + eq(1, #meths.nvim_list_tabpages()) end) it('if called from non-floating window', function() - meths.buf_delete(old_buf, {force = false}) + meths.nvim_buf_delete(old_buf, {force = false}) end) it('if called from floating window with the same buffer', function() - meths.set_current_win(same_buf_float) - meths.buf_delete(old_buf, {force = false}) + meths.nvim_set_current_win(same_buf_float) + meths.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.set_current_win(other_buf_float) - meths.buf_delete(old_buf, {force = false}) + meths.nvim_set_current_win(other_buf_float) + meths.nvim_buf_delete(old_buf, {force = false}) end) end) -- TODO: what to do when there are non-closeable floating windows? @@ -868,8 +868,8 @@ describe('float window', function() end) it('can be created and reconfigured', function() - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + 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 expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 5, true}, } @@ -900,7 +900,7 @@ describe('float window', function() end - meths.win_set_config(win, {relative='editor', row=0, col=10}) + meths.nvim_win_set_config(win, {relative='editor', row=0, col=10}) expected_pos[4][4] = 0 expected_pos[4][5] = 10 if multigrid then @@ -926,7 +926,7 @@ describe('float window', function() ]]) end - meths.win_close(win, false) + meths.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -949,8 +949,8 @@ describe('float window', function() it('window position fixed', function() command('rightbelow 20vsplit') - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, false, { + local buf = meths.nvim_create_buf(false,false) + local win = meths.nvim_open_win(buf, false, { relative='win', width=15, height=2, row=2, col=10, anchor='NW', fixed=true}) if multigrid then @@ -985,7 +985,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {fixed=false}) + meths.nvim_win_set_config(win, {fixed=false}) if multigrid then screen:expect_unchanged() @@ -1009,8 +1009,8 @@ describe('float window', function() -- or something. command("set redrawdebug=compositor") command("set wd=1") - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + 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 expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 5, true}, } @@ -1041,7 +1041,7 @@ describe('float window', function() end - meths.win_set_config(win, {relative='editor', row=0, col=10}) + meths.nvim_win_set_config(win, {relative='editor', row=0, col=10}) expected_pos[4][4] = 0 expected_pos[4][5] = 10 if multigrid then @@ -1067,7 +1067,7 @@ describe('float window', function() ]]) end - meths.win_close(win, false) + meths.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -1089,16 +1089,16 @@ describe('float window', function() end) it('return their configuration', function() - local buf = meths.create_buf(false, false) - local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60}) + local 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 expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false} - eq(expected, meths.win_get_config(win)) + eq(expected, meths.nvim_win_get_config(win)) - eq({relative='', external=false, focusable=true, hide=false}, meths.win_get_config(0)) + eq({relative='', external=false, focusable=true, hide=false}, meths.nvim_win_get_config(0)) if multigrid then - meths.win_set_config(win, {external=true, width=10, height=1}) - eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, meths.win_get_config(win)) + 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)) end end) @@ -1106,7 +1106,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.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10}) + local win = meths.nvim_open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1137,8 +1137,8 @@ describe('float window', function() ]]) end - local buf = meths.create_buf(false, true) - meths.win_set_buf(win, buf) + local buf = meths.nvim_create_buf(false, true) + meths.nvim_win_set_buf(win, buf) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1174,7 +1174,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.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + local win = meths.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 @@ -1238,8 +1238,8 @@ describe('float window', function() end command('sign unplace 1 buffer=1') - local buf = meths.create_buf(false, true) - meths.win_set_buf(win, buf) + local buf = meths.nvim_create_buf(false, true) + meths.nvim_win_set_buf(win, buf) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1274,7 +1274,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.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + local win = meths.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 @@ -1338,8 +1338,8 @@ describe('float window', function() end command('sign unplace 1 buffer=1') - local buf = meths.create_buf(false, true) - meths.win_set_buf(win, buf) + local buf = meths.nvim_create_buf(false, true) + meths.nvim_win_set_buf(win, buf) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1375,7 +1375,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.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + meths.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 @@ -1406,10 +1406,10 @@ describe('float window', function() end) it('can have border', function() - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = meths.nvim_create_buf(false, false) + meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.open_win(buf, false, {relative='editor', width=9, height=2, row=2, col=5, border="double"}) + local win = meths.nvim_open_win(buf, false, {relative='editor', width=9, height=2, row=2, col=5, border="double"}) if multigrid then screen:expect{grid=[[ @@ -1444,7 +1444,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border="single"}) + meths.nvim_win_set_config(win, {border="single"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1478,7 +1478,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border="rounded"}) + meths.nvim_win_set_config(win, {border="rounded"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1512,7 +1512,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border="solid"}) + meths.nvim_win_set_config(win, {border="solid"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1547,7 +1547,7 @@ describe('float window', function() end -- support: ascii char, UTF-8 char, composed char, highlight per char - meths.win_set_config(win, {border={"x", {"å", "ErrorMsg"}, {"\\"}, {"n̈̊", "Search"}}}) + meths.nvim_win_set_config(win, {border={"x", {"å", "ErrorMsg"}, {"\\"}, {"n̈̊", "Search"}}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1581,7 +1581,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border="none"}) + meths.nvim_win_set_config(win, {border="none"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1612,7 +1612,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border={"", "", "", ">", "", "", "", "<"}}) + meths.nvim_win_set_config(win, {border={"", "", "", ">", "", "", "", "<"}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1643,7 +1643,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {border={"", "_", "", "", "", "-", "", ""}}) + meths.nvim_win_set_config(win, {border={"", "_", "", "", "", "-", "", ""}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1685,7 +1685,7 @@ describe('float window', function() of border shadow ]] - meths.win_set_config(win, {border="shadow"}) + meths.nvim_win_set_config(win, {border="shadow"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1724,13 +1724,13 @@ describe('float window', function() end) it('validates title title_pos', function() - local buf = meths.create_buf(false,false) + local buf = meths.nvim_create_buf(false,false) eq("title requires border to be set", - pcall_err(meths.open_win,buf, false, { + pcall_err(meths.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.open_win,buf, false, { + pcall_err(meths.nvim_open_win,buf, false, { relative='editor', width=9, height=2, row=2, col=5, border='single', title_pos='left', })) @@ -1758,13 +1758,13 @@ describe('float window', function() end) it('validates footer footer_pos', function() - local buf = meths.create_buf(false,false) + local buf = meths.nvim_create_buf(false,false) eq("footer requires border to be set", - pcall_err(meths.open_win,buf, false, { + pcall_err(meths.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.open_win,buf, false, { + pcall_err(meths.nvim_open_win,buf, false, { relative='editor', width=9, height=2, row=2, col=5, border='single', footer_pos='left', })) @@ -1792,10 +1792,10 @@ describe('float window', function() end) it('center aligned title longer than window width #25746', function() - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = meths.nvim_create_buf(false, false) + meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.open_win(buf, false, { + local win = meths.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", title = "abcdefghijklmnopqrstuvwxyz",title_pos = "center", }) @@ -1833,15 +1833,15 @@ describe('float window', function() ]]} end - meths.win_close(win, false) + meths.nvim_win_close(win, false) assert_alive() end) it('border with title', function() - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = meths.nvim_create_buf(false, false) + meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.open_win(buf, false, { + local win = meths.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", title = "Left",title_pos = "left", }) @@ -1879,7 +1879,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {title= "Center",title_pos="center"}) + meths.nvim_win_set_config(win, {title= "Center",title_pos="center"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1913,7 +1913,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {title= "Right",title_pos="right"}) + meths.nvim_win_set_config(win, {title= "Right",title_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1947,7 +1947,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {title= { {"🦄"},{"BB"}},title_pos="right"}) + meths.nvim_win_set_config(win, {title= { {"🦄"},{"BB"}},title_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -1983,10 +1983,10 @@ describe('float window', function() end) it('border with footer', function() - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = meths.nvim_create_buf(false, false) + meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.open_win(buf, false, { + local win = meths.nvim_open_win(buf, false, { relative='editor', width=9, height=2, row=2, col=5, border="double", footer = "Left",footer_pos = "left", }) @@ -2024,7 +2024,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {footer= "Center",footer_pos="center"}) + meths.nvim_win_set_config(win, {footer= "Center",footer_pos="center"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2058,7 +2058,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {footer= "Right",footer_pos="right"}) + meths.nvim_win_set_config(win, {footer= "Right",footer_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2092,7 +2092,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {footer= { {"🦄"},{"BB"}},footer_pos="right"}) + meths.nvim_win_set_config(win, {footer= { {"🦄"},{"BB"}},footer_pos="right"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2128,10 +2128,10 @@ describe('float window', function() end) it('border with title and footer', function() - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = meths.nvim_create_buf(false, false) + meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.open_win(buf, false, { + local win = meths.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", }) @@ -2169,7 +2169,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {title= "Center",title_pos="center",footer= "Center",footer_pos="center"}) + meths.nvim_win_set_config(win, {title= "Center",title_pos="center",footer= "Center",footer_pos="center"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2203,7 +2203,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {title= "Right",title_pos="right",footer= "Left",footer_pos="left"}) + meths.nvim_win_set_config(win, {title= "Right",title_pos="right",footer= "Left",footer_pos="left"}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2239,7 +2239,7 @@ describe('float window', function() command('hi B0 guibg=Red guifg=Black') command('hi B1 guifg=White') - meths.win_set_config(win, { + meths.nvim_win_set_config(win, { title = {{"🦄"}, {"BB", {"B0", "B1"}}}, title_pos = "right", footer= {{"🦄"}, {"BB", {"B0", "B1"}}}, footer_pos = "right", }) @@ -2278,8 +2278,8 @@ describe('float window', function() end) it('terminates border on edge of viewport when window extends past viewport', function() - local buf = meths.create_buf(false, false) - meths.open_win(buf, false, {relative='editor', width=40, height=7, row=0, col=0, border="single", zindex=201}) + 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}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2313,10 +2313,10 @@ describe('float window', function() it('with border show popupmenu', function() screen:try_resize(40,10) - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {'aaa aab ', + local buf = meths.nvim_create_buf(false, false) + meths.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', 'abb acc ', ''}) - meths.open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5, border="double"}) + meths.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5, border="double"}) feed 'G' if multigrid then @@ -2482,10 +2482,10 @@ describe('float window', function() it('show ruler of current floating window', function() command 'set ruler' - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {'aaa aab ', + local buf = meths.nvim_create_buf(false, false) + meths.nvim_buf_set_lines(buf, 0, -1, true, {'aaa aab ', 'abb acc '}) - meths.open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5}) + meths.nvim_open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5}) feed 'gg' if multigrid then @@ -2552,7 +2552,7 @@ describe('float window', function() it("correct ruler position in current float with 'rulerformat' set", function() command 'set ruler rulerformat=fish:<><' - meths.open_win(0, true, {relative='editor', width=9, height=3, row=0, col=5}) + meths.nvim_open_win(0, true, {relative='editor', width=9, height=3, row=0, col=5}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2585,10 +2585,10 @@ 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.open_win(0, false, {relative='editor', width=3, height=3, row=0, col=0}) - meths.open_win(0, false, {relative='editor', width=3, height=3, row=0, col=5}) + 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}) feed '<c-w>w' - neq('', meths.win_get_config(0).relative) + neq('', meths.nvim_win_get_config(0).relative) neq(funcs.winnr '$', funcs.winnr()) if multigrid then screen:expect{grid=[[ @@ -2659,9 +2659,9 @@ describe('float window', function() it('can have minimum size', function() insert("the background text") - local buf = meths.create_buf(false, true) - meths.buf_set_lines(buf, 0, -1, true, {'x'}) - local win = meths.open_win(buf, false, {relative='win', width=1, height=1, row=0, col=4, focusable=false}) + 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}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2685,7 +2685,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='win', row=0, col=15}) + meths.nvim_win_set_config(win, {relative='win', row=0, col=15}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2709,7 +2709,7 @@ describe('float window', function() ]]) end - meths.win_close(win,false) + meths.nvim_win_close(win,false) if multigrid then screen:expect([[ ## grid 1 @@ -2745,8 +2745,8 @@ describe('float window', function() command('sargument 6') local float_opts = { relative = 'editor', row = 6, col = 0, width = 40, height = 1 } - meths.win_set_config(w3, float_opts) - meths.win_set_config(w4, float_opts) + meths.nvim_win_set_config(w3, float_opts) + meths.nvim_win_set_config(w4, float_opts) command('wincmd =') if multigrid then screen:expect{grid=[[ @@ -2875,36 +2875,36 @@ describe('float window', function() end) it('API has proper error messages', function() - local buf = meths.create_buf(false,false) + local buf = meths.nvim_create_buf(false,false) eq("Invalid key: 'bork'", - pcall_err(meths.open_win,buf, false, {width=20,height=2,bork=true})) + pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,bork=true})) eq("'win' key is only valid with relative='win'", - pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0})) + pcall_err(meths.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.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,external=true})) + pcall_err(meths.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.open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0})) + pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0})) eq("Invalid value of 'anchor' key", - pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,anchor='bottom'})) + pcall_err(meths.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.open_win,buf, false, {width=20,height=2,relative='editor'})) + pcall_err(meths.nvim_open_win,buf, false, {width=20,height=2,relative='editor'})) eq("'width' key must be a positive Integer", - pcall_err(meths.open_win,buf, false, {width=-1,height=2,relative='editor', row=0, col=0})) + pcall_err(meths.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.open_win,buf, false, {width=20,height=-1,relative='editor', row=0, col=0})) + pcall_err(meths.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.open_win,buf, false, {width=20,height=0,relative='editor', row=0, col=0})) + pcall_err(meths.nvim_open_win,buf, false, {width=20,height=0,relative='editor', row=0, col=0})) eq("Must specify 'width'", - pcall_err(meths.open_win,buf, false, {relative='editor', row=0, col=0})) + pcall_err(meths.nvim_open_win,buf, false, {relative='editor', row=0, col=0})) eq("Must specify 'height'", - pcall_err(meths.open_win,buf, false, {relative='editor', row=0, col=0, width=2})) + pcall_err(meths.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.buf_set_lines(0, 0, -1, true, {'just some', 'example text'}) + meths.nvim_buf_set_lines(0, 0, -1, true, {'just some', 'example text'}) feed('gge') - local oldwin = meths.get_current_win() + local oldwin = meths.nvim_get_current_win() command('below split') if multigrid then screen:expect([[ @@ -2939,9 +2939,9 @@ describe('float window', function() ]]) end - local buf = meths.create_buf(false,false) + local buf = meths.nvim_create_buf(false,false) -- no 'win' arg, relative default window - local win = meths.open_win(buf, false, {relative='win', width=20, height=2, row=0, col=10}) + local win = meths.nvim_open_win(buf, false, {relative='win', width=20, height=2, row=0, col=10}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2980,7 +2980,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='cursor', row=1, col=-2}) + meths.nvim_win_set_config(win, {relative='cursor', row=1, col=-2}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3019,7 +3019,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='cursor', row=0, col=0, anchor='SW'}) + meths.nvim_win_set_config(win, {relative='cursor', row=0, col=0, anchor='SW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3058,7 +3058,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='win', win=oldwin, row=1, col=10, anchor='NW'}) + meths.nvim_win_set_config(win, {relative='win', win=oldwin, row=1, col=10, anchor='NW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3097,7 +3097,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='win', win=oldwin, row=3, col=39, anchor='SE'}) + meths.nvim_win_set_config(win, {relative='win', win=oldwin, row=3, col=39, anchor='SE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3136,7 +3136,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='win', win=0, row=0, col=50, anchor='NE'}) + meths.nvim_win_set_config(win, {relative='win', win=0, row=0, col=50, anchor='NE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3206,7 +3206,7 @@ describe('float window', function() it('always anchor to corner including border', function() screen:try_resize(40,13) - meths.buf_set_lines(0, 0, -1, true, {'just some example text', 'some more example text'}) + meths.nvim_buf_set_lines(0, 0, -1, true, {'just some example text', 'some more example text'}) feed('ggeee') command('below split') if multigrid then @@ -3242,10 +3242,10 @@ describe('float window', function() ]]) end - local buf = meths.create_buf(false, false) - meths.buf_set_lines(buf, 0, -1, true, {' halloj! ', + local buf = meths.nvim_create_buf(false, false) + meths.nvim_buf_set_lines(buf, 0, -1, true, {' halloj! ', ' BORDAA '}) - local win = meths.open_win(buf, false, {relative='cursor', width=9, height=2, row=1, col=-2, border="double"}) + local win = meths.nvim_open_win(buf, false, {relative='cursor', width=9, height=2, row=1, col=-2, border="double"}) if multigrid then screen:expect{grid=[[ @@ -3289,7 +3289,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='cursor', row=0, col=-2, anchor='NE'}) + meths.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='NE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3332,7 +3332,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='cursor', row=1, col=-2, anchor='SE'}) + meths.nvim_win_set_config(win, {relative='cursor', row=1, col=-2, anchor='SE'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3375,7 +3375,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='cursor', row=0, col=-2, anchor='SW'}) + meths.nvim_win_set_config(win, {relative='cursor', row=0, col=-2, anchor='SW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3595,8 +3595,8 @@ describe('float window', function() it('can be placed relative text in a window', function() screen:try_resize(30,5) - local firstwin = meths.get_current_win().id - meths.buf_set_lines(0, 0, -1, true, {'just some', 'example text that is wider than the window', '', '', 'more text'}) + 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'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3619,10 +3619,10 @@ describe('float window', function() ]]} end - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'some info!'}) + local buf = meths.nvim_create_buf(false,false) + meths.nvim_buf_set_lines(buf, 0, -1, true, {'some info!'}) - local win = meths.open_win(buf, false, {relative='win', width=12, height=1, bufpos={1,32}}) + local win = meths.nvim_open_win(buf, false, {relative='win', width=12, height=1, bufpos={1,32}}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3650,7 +3650,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.win_get_config(win)) + external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, meths.nvim_win_get_config(win)) feed('<c-e>') if multigrid then @@ -3738,7 +3738,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {relative='win', bufpos={1,32}, anchor='SW'}) + meths.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='SW'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3811,7 +3811,7 @@ describe('float window', function() end command('close') - meths.win_set_config(win, {relative='win', bufpos={1,32}, anchor='NW', col=-2}) + meths.nvim_win_set_config(win, {relative='win', bufpos={1,32}, anchor='NW', col=-2}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3842,7 +3842,7 @@ describe('float window', function() ]]} end - meths.win_set_config(win, {relative='win', bufpos={1,32}, row=2}) + meths.nvim_win_set_config(win, {relative='win', bufpos={1,32}, row=2}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3923,9 +3923,9 @@ describe('float window', function() ]]) end - local buf = meths.create_buf(false,true) - meths.buf_set_lines(buf, 0, -1, true, {'some floaty text'}) - meths.open_win(buf, false, {relative='editor', width=20, height=1, row=3, col=1}) + 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}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -3958,8 +3958,8 @@ describe('float window', function() local screen2 = Screen.new(40,7) screen2:attach(nil, session2) screen2:set_default_attr_ids(attrs) - local buf = meths.create_buf(false,false) - meths.open_win(buf, true, {relative='editor', width=20, height=2, row=2, col=5}) + 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 expected_pos = { [2]={{id=1001}, 'NW', 1, 2, 5} } @@ -3985,9 +3985,9 @@ describe('float window', function() it('handles resized screen', function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'such', 'very', 'float'}) - local win = meths.open_win(buf, false, {relative='editor', width=15, height=4, row=2, col=10}) + local 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 expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 10, true}, } @@ -4150,7 +4150,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {height=3}) + meths.nvim_win_set_config(win, {height=3}) feed('gg') if multigrid then screen:expect{grid=[[ @@ -4435,8 +4435,8 @@ describe('float window', function() command("set inccommand=split") command("set laststatus=2") - local buf = meths.create_buf(false,false) - meths.open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0}) + local buf = meths.nvim_create_buf(false,false) + meths.nvim_open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0}) insert([[ foo @@ -4532,17 +4532,17 @@ describe('float window', function() end) it('does not crash when set cmdheight #9680', function() - local buf = meths.create_buf(false,false) - meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) + local buf = meths.nvim_create_buf(false,false) + meths.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) command("set cmdheight=2") - eq(1, meths.eval('1')) + eq(1, meths.nvim_eval('1')) end) describe('and completion', function() before_each(function() - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5}).id - meths.set_option_value('winhl', 'Normal:ErrorMsg', {win=win}) + 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}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4890,9 +4890,9 @@ describe('float window', function() ]]) end - local buf = meths.create_buf(false,true) - meths.buf_set_lines(buf,0,-1,true,{"some info", "about item"}) - win = meths.open_win(buf, false, {relative='cursor', width=12, height=2, row=1, col=10}) + 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}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -4954,7 +4954,7 @@ describe('float window', function() ]]) end - meths.win_close(win, false) + meths.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -4976,7 +4976,7 @@ describe('float window', function() end) it('and close float first', function() - meths.win_close(win, false) + meths.nvim_win_close(win, false) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -5028,10 +5028,10 @@ describe('float window', function() end) it("can use Normal as background", function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf,0,-1,true,{"here", "float"}) - local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.set_option_value('winhl', 'Normal:Normal', {win=win}) + 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}) if multigrid then screen:expect{grid=[[ @@ -5071,10 +5071,10 @@ describe('float window', function() -- the default, but be explicit: command("set laststatus=1") command("set hidden") - meths.buf_set_lines(0,0,-1,true,{"x"}) - local buf = meths.create_buf(false,false) - win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.buf_set_lines(buf,0,-1,true,{"y"}) + 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"}) expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 5, true} } @@ -5159,7 +5159,7 @@ describe('float window', function() end) it("w with focusable=false", function() - meths.win_set_config(win, {focusable=false}) + meths.nvim_win_set_config(win, {focusable=false}) expected_pos[4][6] = false feed("<c-w>wi") -- i to provoke redraw if multigrid then @@ -5270,7 +5270,7 @@ describe('float window', function() it("focus by mouse", function() if multigrid then - meths.input_mouse('left', 'press', '', 4, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -5285,7 +5285,7 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos} else - meths.input_mouse('left', 'press', '', 0, 2, 5) + meths.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect([[ x | {0:~ }| @@ -5297,7 +5297,7 @@ describe('float window', function() end if multigrid then - meths.input_mouse('left', 'press', '', 2, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -5312,7 +5312,7 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos} else - meths.input_mouse('left', 'press', '', 0, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ ^x | {0:~ }| @@ -5325,11 +5325,11 @@ describe('float window', function() end) it("focus by mouse (focusable=false)", function() - meths.win_set_config(win, {focusable=false}) - meths.buf_set_lines(0, -1, -1, true, {"a"}) + meths.nvim_win_set_config(win, {focusable=false}) + meths.nvim_buf_set_lines(0, -1, -1, true, {"a"}) expected_pos[4][6] = false if multigrid then - meths.input_mouse('left', 'press', '', 4, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -5345,7 +5345,7 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos} else - meths.input_mouse('left', 'press', '', 0, 2, 5) + meths.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect([[ x | ^a | @@ -5357,7 +5357,7 @@ describe('float window', function() end if multigrid then - meths.input_mouse('left', 'press', '', 2, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 2, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -5373,7 +5373,7 @@ describe('float window', function() {2:~ }| ]], float_pos=expected_pos, unchanged=true} else - meths.input_mouse('left', 'press', '', 0, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ ^x | a | @@ -6155,7 +6155,7 @@ describe('float window', function() -- enter first float feed('<c-w><c-w>') -- enter second float - meths.open_win(0, true, {relative='editor', width=20, height=2, row=4, col=8}) + meths.nvim_open_win(0, true, {relative='editor', width=20, height=2, row=4, col=8}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -6475,7 +6475,7 @@ describe('float window', function() end if multigrid then - meths.win_set_config(0, {external=true, width=30, height=2}) + meths.nvim_win_set_config(0, {external=true, width=30, height=2}) expected_pos = {[4]={external=true}} screen:expect{grid=[[ ## grid 1 @@ -6493,7 +6493,7 @@ describe('float window', function() ]], float_pos=expected_pos} else eq("UI doesn't support external windows", - pcall_err(meths.win_set_config, 0, {external=true, width=30, height=2})) + pcall_err(meths.nvim_win_set_config, 0, {external=true, width=30, height=2})) return end @@ -6519,7 +6519,7 @@ describe('float window', function() end) it('J (float with border)', function() - meths.win_set_config(win, {relative='editor', width=20, height=2, row=2, col=5, border='single'}) + meths.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 @@ -6791,7 +6791,7 @@ describe('float window', function() it(":tabnew and :tabnext (external)", function() if multigrid then -- also test external window wider than main screen - meths.win_set_config(win, {external=true, width=65, height=4}) + meths.nvim_win_set_config(win, {external=true, width=65, height=4}) expected_pos = {[4]={external=true}} feed(":tabnew<cr>") screen:expect{grid=[[ @@ -6813,7 +6813,7 @@ describe('float window', function() ]], float_pos=expected_pos} else eq("UI doesn't support external windows", - pcall_err(meths.win_set_config, 0, {external=true, width=65, height=4})) + pcall_err(meths.nvim_win_set_config, 0, {external=true, width=65, height=4})) end feed(":tabnext<cr>") @@ -6861,9 +6861,9 @@ describe('float window', function() end) it("left drag changes visual selection in float window", function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - meths.open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=5}) + 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}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -6885,7 +6885,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'press', '', 4, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -6906,7 +6906,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'drag', '', 4, 1, 2) + meths.nvim_input_mouse('left', 'drag', '', 4, 1, 2) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -6937,7 +6937,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'press', '', 0, 2, 5) + meths.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect{grid=[[ | {0:~ }| @@ -6948,7 +6948,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'drag', '', 0, 3, 7) + meths.nvim_input_mouse('left', 'drag', '', 0, 3, 7) screen:expect{grid=[[ | {0:~ }| @@ -6962,9 +6962,9 @@ describe('float window', function() end) it("left drag changes visual selection in float window with border", function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - meths.open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) + 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'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -6988,7 +6988,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'press', '', 4, 1, 1) + meths.nvim_input_mouse('left', 'press', '', 4, 1, 1) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7011,7 +7011,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'drag', '', 4, 2, 3) + meths.nvim_input_mouse('left', 'drag', '', 4, 2, 3) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7044,7 +7044,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'press', '', 0, 1, 6) + meths.nvim_input_mouse('left', 'press', '', 0, 1, 6) screen:expect{grid=[[ {5:┌────────────────────┐} | {0:~ }{5:│}{1:^foo }{5:│}{0: }| @@ -7055,7 +7055,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'drag', '', 0, 2, 8) + meths.nvim_input_mouse('left', 'drag', '', 0, 2, 8) screen:expect{grid=[[ {5:┌────────────────────┐} | {0:~ }{5:│}{27:foo}{1: }{5:│}{0: }| @@ -7069,10 +7069,10 @@ describe('float window', function() end) it("left drag changes visual selection in float window with winbar", function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - local float_win = meths.open_win(buf, false, {relative='editor', width=20, height=4, row=1, col=5}) - meths.set_option_value('winbar', 'floaty bar', {win=float_win.id}) + 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}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7095,7 +7095,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'press', '', 4, 1, 0) + meths.nvim_input_mouse('left', 'press', '', 4, 1, 0) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7117,7 +7117,7 @@ describe('float window', function() [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0}; }} - meths.input_mouse('left', 'drag', '', 4, 2, 2) + meths.nvim_input_mouse('left', 'drag', '', 4, 2, 2) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7149,7 +7149,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'press', '', 0, 2, 5) + meths.nvim_input_mouse('left', 'press', '', 0, 2, 5) screen:expect{grid=[[ | {0:~ }{3:floaty bar }{0: }| @@ -7160,7 +7160,7 @@ describe('float window', function() | ]]} - meths.input_mouse('left', 'drag', '', 0, 3, 7) + meths.nvim_input_mouse('left', 'drag', '', 0, 3, 7) screen:expect{grid=[[ | {0:~ }{3:floaty bar }{0: }| @@ -7174,9 +7174,9 @@ describe('float window', function() end) it('left drag changes visual selection if float window is turned into a split', function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) - meths.open_win(buf, true, {relative='editor', width=20, height=3, row=2, col=5}) + 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}) command('wincmd L') if multigrid then screen:expect([[ @@ -7196,7 +7196,7 @@ describe('float window', function() {0:~ }|*2 ]]) - meths.input_mouse('left', 'press', '', 4, 2, 2) + meths.nvim_input_mouse('left', 'press', '', 4, 2, 2) screen:expect([[ ## grid 1 [2:-------------------]{5:│}[4:--------------------]|*5 @@ -7214,7 +7214,7 @@ describe('float window', function() {0:~ }|*2 ]]) - meths.input_mouse('left', 'drag', '', 4, 1, 1) + meths.nvim_input_mouse('left', 'drag', '', 4, 1, 1) screen:expect([[ ## grid 1 [2:-------------------]{5:│}[4:--------------------]|*5 @@ -7241,7 +7241,7 @@ describe('float window', function() | ]]) - meths.input_mouse('left', 'press', '', 0, 2, 22) + meths.nvim_input_mouse('left', 'press', '', 0, 2, 22) screen:expect([[ {5:│}foo | {0:~ }{5:│}bar | @@ -7251,7 +7251,7 @@ describe('float window', function() | ]]) - meths.input_mouse('left', 'drag', '', 0, 1, 21) + meths.nvim_input_mouse('left', 'drag', '', 0, 1, 21) screen:expect([[ {5:│}foo | {0:~ }{5:│}b^a{27:r} | @@ -7264,9 +7264,9 @@ describe('float window', function() end) it('left click sets correct curswant in float window with border', function() - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'', '', ''}) - meths.open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'}) + 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'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7298,23 +7298,23 @@ describe('float window', function() end if multigrid then - meths.input_mouse('left', 'press', '', 4, 3, 1) + meths.nvim_input_mouse('left', 'press', '', 4, 3, 1) else - meths.input_mouse('left', 'press', '', 0, 3, 6) + meths.nvim_input_mouse('left', 'press', '', 0, 3, 6) end eq({0, 3, 1, 0, 1}, funcs.getcurpos()) if multigrid then - meths.input_mouse('left', 'press', '', 4, 3, 2) + meths.nvim_input_mouse('left', 'press', '', 4, 3, 2) else - meths.input_mouse('left', 'press', '', 0, 3, 7) + meths.nvim_input_mouse('left', 'press', '', 0, 3, 7) end eq({0, 3, 1, 0, 2}, funcs.getcurpos()) if multigrid then - meths.input_mouse('left', 'press', '', 4, 3, 10) + meths.nvim_input_mouse('left', 'press', '', 4, 3, 10) else - meths.input_mouse('left', 'press', '', 0, 3, 15) + meths.nvim_input_mouse('left', 'press', '', 0, 3, 15) end eq({0, 3, 1, 0, 10}, funcs.getcurpos()) @@ -7355,7 +7355,7 @@ describe('float window', function() end if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 1) + meths.nvim_input_mouse('left', 'press', '', 4, 2, 1) screen:expect{grid=[[ ## grid 1 [2:----------------------------------------]|*6 @@ -7378,7 +7378,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.input_mouse('left', 'press', '', 0, 2, 6) + meths.nvim_input_mouse('left', 'press', '', 0, 2, 6) screen:expect{grid=[[ {5:┌────────────────────┐} | {0:~ }{5:│}{19: }{1:^ }{5:│}{0: }| @@ -7391,23 +7391,23 @@ describe('float window', function() end if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 2) + meths.nvim_input_mouse('left', 'press', '', 4, 2, 2) else - meths.input_mouse('left', 'press', '', 0, 2, 7) + meths.nvim_input_mouse('left', 'press', '', 0, 2, 7) end eq({0, 2, 1, 0, 1}, funcs.getcurpos()) if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 3) + meths.nvim_input_mouse('left', 'press', '', 4, 2, 3) else - meths.input_mouse('left', 'press', '', 0, 2, 8) + meths.nvim_input_mouse('left', 'press', '', 0, 2, 8) end eq({0, 2, 1, 0, 2}, funcs.getcurpos()) if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 11) + meths.nvim_input_mouse('left', 'press', '', 4, 2, 11) else - meths.input_mouse('left', 'press', '', 0, 2, 16) + meths.nvim_input_mouse('left', 'press', '', 0, 2, 16) end eq({0, 2, 1, 0, 10}, funcs.getcurpos()) end) @@ -7453,9 +7453,9 @@ describe('float window', function() occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.]]) - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {"test", "", "popup text"}) - local win = meths.open_win(buf, false, {relative='editor', width=15, height=3, row=2, col=5}) + 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}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7491,7 +7491,7 @@ describe('float window', function() ]]) end - meths.set_option_value("winblend", 30, {win=win.id}) + meths.nvim_set_option_value("winblend", 30, {win=win.id}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7528,7 +7528,7 @@ describe('float window', function() end -- Check that 'winblend' works with NormalNC highlight - meths.set_option_value('winhighlight', 'NormalNC:Visual', {win = win}) + meths.nvim_set_option_value('winhighlight', 'NormalNC:Visual', {win = win}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7573,7 +7573,7 @@ describe('float window', function() command('hi clear NormalNC') command('hi SpecialRegion guifg=Red blend=0') - meths.buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1) + meths.nvim_buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7647,7 +7647,7 @@ describe('float window', function() -- Test scrolling by mouse if multigrid then - meths.input_mouse('wheel', 'down', '', 4, 2, 2) + meths.nvim_input_mouse('wheel', 'down', '', 4, 2, 2) screen:expect{grid=[[ ## grid 1 [2:--------------------------------------------------]|*8 @@ -7668,7 +7668,7 @@ describe('float window', function() {12:~ }|*2 ]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}} else - meths.input_mouse('wheel', 'down', '', 0, 4, 7) + meths.nvim_input_mouse('wheel', 'down', '', 0, 4, 7) screen:expect([[ Ut enim ad minim veniam, quis nostrud | exercitation ullamco laboris nisi ut aliquip ex | @@ -7683,9 +7683,9 @@ describe('float window', function() end -- Check that 'winblend' applies to border/title/footer - meths.win_set_config(win, {border='single', title='Title', footer='Footer'}) - meths.set_option_value('winblend', 100, {win=win.id}) - meths.set_option_value("cursorline", true, {win=0}) + 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}) command('hi clear VertSplit') feed('k0') if multigrid then @@ -7729,9 +7729,9 @@ describe('float window', function() insert([[ # TODO: 测试字典信息的准确性 # FIXME: 测试字典信息的准确性]]) - local buf = meths.create_buf(false,false) - meths.buf_set_lines(buf, 0, -1, true, {'口', '口'}) - local win = meths.open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'}) + 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'}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7757,7 +7757,7 @@ describe('float window', function() ]]) end - meths.win_close(win, false) + meths.nvim_win_close(win, false) if multigrid then screen:expect([[ ## grid 1 @@ -7782,9 +7782,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.buf_set_lines(buf, 0, -1, true, {" x x x xx", " x x x x"}) - win = meths.open_win(buf, false, {relative='editor', width=12, height=3, row=0, col=11, style='minimal'}) - meths.set_option_value('winblend', 30, {win=win.id}) + 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}) screen:set_default_attr_ids({ [1] = {foreground = tonumber('0xb282b2'), background = tonumber('0xffcfff')}, [2] = {foreground = Screen.colors.Grey0, background = tonumber('0xffcfff')}, @@ -7820,7 +7820,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {relative='editor', row=0, col=12}) + meths.nvim_win_set_config(win, {relative='editor', row=0, col=12}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -7974,9 +7974,9 @@ describe('float window', function() end) it("correctly orders multiple opened floats (current last)", function() - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id}) + 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}) if multigrid then screen:expect{grid=[[ @@ -8060,9 +8060,9 @@ describe('float window', function() end) it("correctly orders multiple opened floats (non-current last)", function() - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) - meths.set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win.id}) + 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}) if multigrid then screen:expect{grid=[[ @@ -8146,13 +8146,13 @@ describe('float window', function() end) it('can use z-index', function() - local buf = meths.create_buf(false,false) - local win1 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=1, col=5, zindex=30}) - meths.set_option_value("winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg", {win=win1.id}) - local win2 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=6, zindex=50}) - meths.set_option_value("winhl", "Normal:Search,EndOfBuffer:Search", {win=win2.id}) - local win3 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=3, col=7, zindex=40}) - meths.set_option_value("winhl", "Normal:Question,EndOfBuffer:Question", {win=win3.id}) + 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}) if multigrid then screen:expect{grid=[[ @@ -8197,9 +8197,9 @@ describe('float window', function() end) it('can use winbar', function() - local buf = meths.create_buf(false,false) - local win1 = meths.open_win(buf, false, {relative='editor', width=15, height=3, row=1, col=5}) - meths.set_option_value('winbar', 'floaty bar', {win=win1.id}) + 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}) if multigrid then screen:expect{grid=[[ @@ -8233,7 +8233,7 @@ describe('float window', function() end -- resize and add a border - meths.win_set_config(win1, {relative='editor', width=15, height=4, row=0, col=4, border = 'single'}) + meths.nvim_win_set_config(win1, {relative='editor', width=15, height=4, row=0, col=4, border = 'single'}) if multigrid then screen:expect{grid=[[ @@ -8272,8 +8272,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.create_buf(false,true) - local win = meths.open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=9, col=0, style='minimal', border="single", noautocmd=true}) + 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}) if multigrid then screen:expect{grid=[[ @@ -8338,7 +8338,7 @@ describe('float window', function() end - meths.win_close(win, true) + meths.nvim_win_close(win, true) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -8360,8 +8360,8 @@ describe('float window', function() it('it can be resized with messages and cmdheight=1', function() screen:try_resize(40,9) - local buf = meths.create_buf(false,true) - local win = meths.open_win(buf, false, {relative='editor', width=40, height=4, anchor='SW', row=8, col=0, style='minimal', border="single", noautocmd=true}) + 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}) if multigrid then screen:expect{grid=[[ @@ -8468,7 +8468,7 @@ describe('float window', function() ]]} end - meths.win_close(win, true) + meths.nvim_win_close(win, true) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -8494,7 +8494,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.open_win(meths.create_buf(false, false), true, float_opts) + meths.nvim_open_win(meths.nvim_create_buf(false, false), true, float_opts) if multigrid then screen:expect({float_pos = {[4] = {{id = 1001}, 'NW', 1, 1, 1, true}}}) end @@ -8521,7 +8521,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.open_win(meths.create_buf(false, false), true, float_opts) + local win = meths.nvim_open_win(meths.nvim_create_buf(false, false), true, float_opts) feed('iab<CR>cd<Esc>') feed(':sleep 100') if multigrid then @@ -8589,7 +8589,7 @@ describe('float window', function() feed('<C-C>') screen:expect_unchanged() - meths.win_set_config(win, {border = 'single'}) + meths.nvim_win_set_config(win, {border = 'single'}) feed(':sleep 100') if multigrid then screen:expect{grid=[[ @@ -8738,7 +8738,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.open_win(meths.create_buf(false, false), true, float_opts) + meths.nvim_open_win(meths.nvim_create_buf(false, false), true, float_opts) command('setlocal rightleft') feed('iabc<CR>def<Esc>') if multigrid then @@ -8777,8 +8777,8 @@ describe('float window', function() end) it('float window with hide option', function() - local buf = meths.create_buf(false,false) - local win = meths.open_win(buf, false, {relative='editor', width=10, height=2, row=2, col=5, hide = true}) + local 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 expected_pos = { [4]={{id=1001}, 'NW', 1, 2, 5, true}, } @@ -8806,7 +8806,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {hide = false}) + meths.nvim_win_set_config(win, {hide = false}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -8833,7 +8833,7 @@ describe('float window', function() ]]) end - meths.win_set_config(win, {hide=true}) + meths.nvim_win_set_config(win, {hide=true}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -8859,18 +8859,18 @@ describe('float window', function() end) it(':fclose command #9663', function() - local buf_a = meths.create_buf(false,false) - local buf_b = meths.create_buf(false,false) - local buf_c = meths.create_buf(false,false) - local buf_d = meths.create_buf(false,false) + local 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 config_a = {relative='editor', width=11, height=11, row=5, col=5, border ='single', zindex=50} local config_b = {relative='editor', width=8, height=8, row=7, col=7, border ='single', zindex=70} local config_c = {relative='editor', width=4, height=4, row=9, col=9, border ='single',zindex=90} local config_d = {relative='editor', width=2, height=2, row=10, col=10, border ='single',zindex=100} - meths.open_win(buf_a, false, config_a) - meths.open_win(buf_b, false, config_b) - meths.open_win(buf_c, false, config_c) - meths.open_win(buf_d, false, config_d) + 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) 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 6951d2eb9a..08dcd18aa0 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -317,7 +317,7 @@ describe('folded lines', function() feed_command('set norightleft') if multigrid then - meths.input_mouse('left', 'press', '', 2, 0, 1) + meths.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.input_mouse('left', 'press', '', 0, 0, 1) + meths.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.input_mouse('left', 'press', '', 2, 0, 0) + meths.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.input_mouse('left', 'press', '', 0, 0, 0) + meths.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.input_mouse('left', 'press', '', 2, 1, 0) + meths.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.input_mouse('left', 'press', '', 0, 1, 0) + meths.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.input_mouse('left', 'press', '', 2, 1, 1) + meths.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.input_mouse('left', 'press', '', 0, 1, 1) + meths.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.input_mouse('left', 'press', '', 4, 0, 0) + meths.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.input_mouse('left', 'press', '', 0, 3, 0) + meths.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.input_mouse('left', 'press', '', 4, 1, 0) + meths.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.input_mouse('left', 'press', '', 0, 4, 0) + meths.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.input_mouse('left', 'press', '', 2, 1, 0) + meths.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.input_mouse('left', 'press', '', 0, 1, 0) + meths.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.input_mouse('left', 'press', '', 2, 0, 0) + meths.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.input_mouse('left', 'press', '', 0, 0, 0) + meths.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.input_mouse('left', 'press', '', 4, 0, 0) + meths.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.input_mouse('left', 'press', '', 0, 0, 23) + meths.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.input_mouse('left', 'press', '', 4, 1, 0) + meths.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.input_mouse('left', 'press', '', 0, 1, 23) + meths.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.input_mouse('left', 'press', '', 2, 1, 0) + meths.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.input_mouse('left', 'press', '', 0, 1, 0) + meths.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.input_mouse('left', 'press', '', 2, 0, 0) + meths.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.input_mouse('left', 'press', '', 0, 0, 0) + meths.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.input_mouse('left', 'press', '', 4, 1, 1) + meths.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.input_mouse('left', 'press', '', 0, 2, 1) + meths.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.input_mouse('left', 'press', '', 4, 0, 0) + meths.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.input_mouse('left', 'press', '', 0, 1, 0) + meths.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.input_mouse('left', 'press', '', 2, 1, 1) + meths.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.input_mouse('left', 'press', '', 0, 2, 1) + meths.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.input_mouse('left', 'press', '', 2, 0, 0) + meths.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.input_mouse('left', 'press', '', 0, 1, 0) + meths.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.get_option_value('arabicshape', {})) + eq(true, meths.nvim_get_option_value('arabicshape', {})) insert([[ å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢͟ العَرَبِيَّة möre text]]) @@ -1531,23 +1531,35 @@ describe('folded lines', function() funcs.setline(3, 'line 3') funcs.setline(4, 'line 4') feed('zfj') - local ns = meths.create_namespace('ns') - meths.buf_set_extmark( + local ns = meths.nvim_create_namespace('ns') + meths.nvim_buf_set_extmark( 0, ns, 0, 0, { virt_lines_above = true, virt_lines = { { { 'virt_line above line 1', '' } } } } ) - meths.buf_set_extmark(0, ns, 1, 0, { virt_lines = { { { 'virt_line below line 2', '' } } } }) - meths.buf_set_extmark( + meths.nvim_buf_set_extmark( + 0, + ns, + 1, + 0, + { virt_lines = { { { 'virt_line below line 2', '' } } } } + ) + meths.nvim_buf_set_extmark( 0, ns, 2, 0, { virt_lines_above = true, virt_lines = { { { 'virt_line above line 3', '' } } } } ) - meths.buf_set_extmark(0, ns, 3, 0, { virt_lines = { { { 'virt_line below line 4', '' } } } }) + meths.nvim_buf_set_extmark( + 0, + ns, + 3, + 0, + { virt_lines = { { { 'virt_line below line 4', '' } } } } + ) if multigrid then screen:expect { grid = [[ @@ -1667,7 +1679,7 @@ describe('folded lines', function() ]]) end - meths.input_mouse('left', 'press', '', multigrid and 2 or 0, 4, 0) + meths.nvim_input_mouse('left', 'press', '', multigrid and 2 or 0, 4, 0) eq({ screencol = 1, screenrow = 5, @@ -1679,7 +1691,7 @@ describe('folded lines', function() coladd = 0, }, funcs.getmousepos()) - meths.buf_set_extmark( + meths.nvim_buf_set_extmark( 0, ns, 1, @@ -1953,7 +1965,7 @@ describe('folded lines', function() ]]) end - meths.input_mouse('left', 'press', '3', multigrid and 2 or 0, 3, 0) + meths.nvim_input_mouse('left', 'press', '3', multigrid and 2 or 0, 3, 0) if multigrid then screen:expect { grid = [[ @@ -1992,7 +2004,7 @@ describe('folded lines', function() ]]) end - meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 0) + meths.nvim_input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 0) if multigrid then screen:expect { grid = [[ @@ -2029,7 +2041,7 @@ describe('folded lines', function() ]]) end - meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 5) + meths.nvim_input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 5) if multigrid then screen:expect { grid = [[ @@ -2419,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.set_option_value('cursorline', true, {}) - meths.set_option_value('foldcolumn', '4', {}) - meths.set_option_value( + meths.nvim_set_option_value('cursorline', true, {}) + meths.nvim_set_option_value('foldcolumn', '4', {}) + meths.nvim_set_option_value( 'foldtext', '[' .. '["▶", ["F0", "F1"]], ' @@ -2511,7 +2523,7 @@ describe('folded lines', function() ]]) end - meths.set_option_value('rightleft', true, {}) + meths.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 54c14fb44a..857fd29f19 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -2403,13 +2403,13 @@ describe('highlight namespaces', function() [10] = { bold = true, foreground = Screen.colors.SeaGreen }, } - ns1 = meths.create_namespace 'grungy' - ns2 = meths.create_namespace 'ultrared' + ns1 = meths.nvim_create_namespace 'grungy' + ns2 = meths.nvim_create_namespace 'ultrared' - meths.set_hl(ns1, 'Normal', { bg = 'DarkGrey' }) - meths.set_hl(ns1, 'NonText', { bg = 'DarkOrange4', fg = 'DarkCyan', italic = true }) - meths.set_hl(ns2, 'Normal', { bg = 'DarkMagenta' }) - meths.set_hl(ns2, 'NonText', { fg = 'Crimson' }) + 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' }) end) it('can be used globally', function() @@ -2421,7 +2421,7 @@ describe('highlight namespaces', function() ]], } - meths.set_hl_ns(ns1) + meths.nvim_set_hl_ns(ns1) screen:expect { grid = [[ {2:^ }| @@ -2430,7 +2430,7 @@ describe('highlight namespaces', function() ]], } - meths.set_hl_ns(ns2) + meths.nvim_set_hl_ns(ns2) screen:expect { grid = [[ {4:^ }| @@ -2439,7 +2439,7 @@ describe('highlight namespaces', function() ]], } - meths.set_hl_ns(0) + meths.nvim_set_hl_ns(0) screen:expect { grid = [[ ^ | @@ -2450,13 +2450,13 @@ describe('highlight namespaces', function() end) it('can be used per window', function() - local win1 = meths.get_current_win() + local win1 = meths.nvim_get_current_win() command 'split' - local win2 = meths.get_current_win() + local win2 = meths.nvim_get_current_win() command 'split' - meths.win_set_hl_ns(win1, ns1) - meths.win_set_hl_ns(win2, ns2) + meths.nvim_win_set_hl_ns(win1, ns1) + meths.nvim_win_set_hl_ns(win2, ns2) screen:expect { grid = [[ @@ -2483,7 +2483,7 @@ describe('highlight namespaces', function() ]], } - meths.set_hl(0, 'EndOfBuffer', { fg = '#333333' }) + meths.nvim_set_hl(0, 'EndOfBuffer', { fg = '#333333' }) screen:expect { grid = [[ ^ | @@ -2508,7 +2508,7 @@ describe('highlight namespaces', function() it('Normal in set_hl #25474', function() command('highlight Ignore guifg=bg ctermfg=White') - meths.set_hl(0, 'Normal', { bg = '#333333' }) + meths.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 8147636326..d6fd864536 100644 --- a/test/functional/ui/hlstate_spec.lua +++ b/test/functional/ui/hlstate_spec.lua @@ -28,8 +28,8 @@ describe('ext_hlstate detailed highlights', function() insert([[ these are some lines with colorful text]]) - meths.buf_add_highlight(0, -1, 'String', 0, 10, 14) - meths.buf_add_highlight(0, -1, 'Statement', 1, 5, -1) + meths.nvim_buf_add_highlight(0, -1, 'String', 0, 10, 14) + meths.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 60bdf97b79..c97fd02562 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -158,7 +158,7 @@ describe(":substitute, 'inccommand' preserves", function() common_setup(screen, 'nosplit', ('abc\ndef\n'):rep(50)) feed('ggyG') - local X = meths.get_vvar('maxcol') + local X = meths.nvim_get_vvar('maxcol') eq({ 0, 1, 1, 0 }, funcs.getpos("'[")) eq({ 0, 101, X, 0 }, funcs.getpos("']")) @@ -205,8 +205,8 @@ describe(":substitute, 'inccommand' preserves", function() feed(':%s/as/glork/') poke_eventloop() feed('<enter>') - eq(meths.get_option_value('undolevels', { scope = 'global' }), 139) - eq(meths.get_option_value('undolevels', { buf = 0 }), 34) + eq(meths.nvim_get_option_value('undolevels', { scope = 'global' }), 139) + eq(meths.nvim_get_option_value('undolevels', { buf = 0 }), 34) end) end @@ -1119,7 +1119,7 @@ describe(':substitute, inccommand=split', function() it("deactivates if 'redrawtime' is exceeded #5602", function() -- prevent redraws from 'incsearch' - meths.set_option_value('incsearch', false, {}) + meths.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. @@ -1752,7 +1752,7 @@ describe("'inccommand' autocommands", function() end local function register_autocmd(event) - meths.set_var(event .. '_fired', {}) + meths.nvim_set_var(event .. '_fired', {}) command('autocmd ' .. event .. ' * call add(g:' .. event .. "_fired, expand('<abuf>'))") end @@ -1768,14 +1768,14 @@ describe("'inccommand' autocommands", function() feed(':%s/tw') for event, _ in pairs(eventsExpected) do - eventsObserved[event].open = meths.get_var(event .. '_fired') - meths.set_var(event .. '_fired', {}) + eventsObserved[event].open = meths.nvim_get_var(event .. '_fired') + meths.nvim_set_var(event .. '_fired', {}) end feed('/<enter>') for event, _ in pairs(eventsExpected) do - eventsObserved[event].close = meths.get_var(event .. '_fired') + eventsObserved[event].close = meths.nvim_get_var(event .. '_fired') end for event, _ in pairs(eventsExpected) do @@ -2614,8 +2614,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.create_buf(false, true) - meths.open_win(float_buf, false, { + local float_buf = meths.nvim_create_buf(false, true) + meths.nvim_open_win(float_buf, false, { relative = 'editor', height = 1, width = 5, @@ -2641,7 +2641,7 @@ it(':substitute with inccommand, allows :redraw before first separator is typed {15:~ }| :%s^ | ]]) - meths.buf_set_lines(float_buf, 0, -1, true, { 'foo' }) + meths.nvim_buf_set_lines(float_buf, 0, -1, true, { 'foo' }) command('redraw') screen:expect([[ foo bar baz | @@ -2745,7 +2745,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.set_keymap('x', '<F2>', '<Esc>`<Oaaaaa asdf<Esc>`>obbbbb asdf<Esc>V`<k:s/asdf/', {}) + meths.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 7cb8d4622d..8a08d459c4 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -392,7 +392,7 @@ end) describe('event processing and input', function() it('not blocked by event bursts', function() - meths.set_keymap( + meths.nvim_set_keymap( '', '<f2>', "<cmd>lua vim.rpcnotify(1, 'stop') winning = true <cr>", diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 2a402437fd..25ae74daf1 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -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.buf_set_lines(0, 0, 0, true, { 'aaa', 'bbb', 'ccc' }) + meths.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.get_option_value('cmdheight', {})) + eq(1, meths.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.get_mode()) + eq({ mode = 'n', blocking = false }, meths.nvim_get_mode()) end) end) @@ -1675,9 +1675,9 @@ describe('ui/ext_messages', function() }) feed(':set mouse=a<cr>') - meths.input_mouse('left', 'press', '', 0, 12, 10) + meths.nvim_input_mouse('left', 'press', '', 0, 12, 10) poke_eventloop() - meths.input_mouse('left', 'drag', '', 0, 11, 10) + meths.nvim_input_mouse('left', 'drag', '', 0, 11, 10) feed('<c-l>') feed(':set cmdheight<cr>') screen:expect({ diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index d1479c13fe..f3025c0d53 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -12,8 +12,8 @@ describe('ui/mouse/input', function() before_each(function() clear() - meths.set_option_value('mouse', 'a', {}) - meths.set_option_value('list', true, {}) + meths.nvim_set_option_value('mouse', 'a', {}) + meths.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.set_option_value('mouse', '', {}) + meths.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.set_option_value('hidden', true, {}) + meths.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.set_option_value('hidden', true, {}) + meths.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.set_option_value('tabline', '%@Test@test%X-%5@Test2@test2', {}) - meths.set_option_value('showtabline', 2, {}) + meths.nvim_set_option_value('tabline', '%@Test@test%X-%5@Test2@test2', {}) + meths.nvim_set_option_value('showtabline', 2, {}) screen:expect([[ {fill:test-test2 }| testing | @@ -441,12 +441,12 @@ describe('ui/mouse/input', function() support and selectio^n | | ]]) - meths.set_var('reply', {}) + meths.nvim_set_var('reply', {}) end) local check_reply = function(expected) - eq(expected, meths.get_var('reply')) - meths.set_var('reply', {}) + eq(expected, meths.nvim_get_var('reply')) + meths.nvim_set_var('reply', {}) end local test_click = function(name, click_str, click_num, mouse_button, modifiers) @@ -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.input_mouse(buttons[mouse_button], 'press', modstr, 0, row, col) + meths.nvim_input_mouse(buttons[mouse_button], 'press', modstr, 0, row, col) end) end) end @@ -609,7 +609,7 @@ describe('ui/mouse/input', function() ]], } - meths.input_mouse('left', 'press', '', 0, 6, 27) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 27) screen:expect { grid = [[ testing │testing | @@ -624,7 +624,7 @@ describe('ui/mouse/input', function() | ]], } - meths.input_mouse('left', 'drag', '', 0, 7, 30) + meths.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.set_option_value('tags', './non-existent-tags-file', {}) + meths.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.set_var('x1_pressed', 0) - meths.set_var('x1_released', 0) - meths.set_var('x2_pressed', 0) - meths.set_var('x2_released', 0) + 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) 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.input_mouse('x1', 'press', '', 0, 0, 0) - meths.input_mouse('x1', 'release', '', 0, 0, 0) - meths.input_mouse('x2', 'press', '', 0, 0, 0) - meths.input_mouse('x2', 'release', '', 0, 0, 0) - eq(1, meths.get_var('x1_pressed'), 'x1 pressed once') - eq(1, meths.get_var('x1_released'), 'x1 released once') - eq(1, meths.get_var('x2_pressed'), 'x2 pressed once') - eq(1, meths.get_var('x2_released'), 'x2 released once') + 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') end) it('dragging vertical separator', function() screen:try_resize(45, 5) command('setlocal nowrap') - local oldwin = meths.get_current_win().id + local oldwin = meths.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.input_mouse('left', 'press', '', 0, 0, 22) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 22) poke_eventloop() - meths.input_mouse('left', 'drag', '', 0, 1, 12) + meths.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.input_mouse('left', 'drag', '', 0, 2, 2) + meths.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.input_mouse('left', 'release', '', 0, 2, 2) - meths.set_option_value('statuscolumn', 'foobar', { win = oldwin }) + meths.nvim_input_mouse('left', 'release', '', 0, 2, 2) + meths.nvim_set_option_value('statuscolumn', 'foobar', { win = oldwin }) screen:expect([[ {8:fo}│{0:^$} | {8:fo}│{0:~ }|*2 {4:< }{5:[No Name] }| | ]]) - meths.input_mouse('left', 'press', '', 0, 0, 2) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 2) poke_eventloop() - meths.input_mouse('left', 'drag', '', 0, 1, 12) + meths.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.input_mouse('left', 'drag', '', 0, 2, 22) + meths.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.input_mouse('left', 'release', '', 0, 2, 22) + meths.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.input_mouse('wheel', 'down', '', 0, 0, 0) + meths.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.input_mouse('wheel', 'up', '', 0, 0, 27) + meths.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.input_mouse('wheel', 'up', '', 0, 7, 27) - meths.input_mouse('wheel', 'up', '', 0, 7, 27) + meths.nvim_input_mouse('wheel', 'up', '', 0, 7, 27) + meths.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.input_mouse('wheel', 'left', '', 0, 0, 27) + meths.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.input_mouse('wheel', 'right', '', 0, 0, 0) + meths.nvim_input_mouse('wheel', 'right', '', 0, 0, 0) screen:expect([[ g | | @@ -1048,7 +1048,7 @@ describe('ui/mouse/input', function() | ]]) - meths.input_mouse('wheel', 'right', '', 0, 0, 27) + meths.nvim_input_mouse('wheel', 'right', '', 0, 0, 27) screen:expect([[ g | | @@ -1068,7 +1068,7 @@ describe('ui/mouse/input', function() | ]]) - meths.input_mouse('wheel', 'right', '', 0, 0, 27) + meths.nvim_input_mouse('wheel', 'right', '', 0, 0, 27) screen:expect([[ g | | @@ -1614,30 +1614,30 @@ describe('ui/mouse/input', function() describe('(extmarks)', function() before_each(function() - local ns = meths.create_namespace('conceal') - meths.buf_set_extmark(0, ns, 0, 11, { end_col = 12, conceal = '' }) - meths.buf_set_extmark(0, ns, 0, 14, { end_col = 15, conceal = '' }) - meths.buf_set_extmark(0, ns, 1, 5, { end_col = 6, conceal = '' }) - meths.buf_set_extmark(0, ns, 1, 8, { end_col = 9, conceal = '' }) - meths.buf_set_extmark(0, ns, 1, 10, { end_col = 11, conceal = '' }) - meths.buf_set_extmark(0, ns, 1, 13, { end_col = 14, conceal = '' }) - meths.buf_set_extmark(0, ns, 1, 15, { end_col = 16, conceal = '' }) - meths.buf_set_extmark(0, ns, 1, 18, { end_col = 19, conceal = '' }) - meths.buf_set_extmark(0, ns, 2, 24, { end_col = 25, conceal = '' }) - meths.buf_set_extmark(0, ns, 2, 29, { end_col = 30, conceal = '' }) - meths.buf_set_extmark(0, ns, 2, 25, { end_col = 29, conceal = 'X' }) - meths.buf_set_extmark(0, ns, 2, 0, { end_col = 1, conceal = '>' }) + 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 = '>' }) end) test_mouse_click_conceal() end) end) it('getmousepos() works correctly', function() - local winwidth = meths.get_option_value('winwidth', {}) + local winwidth = meths.nvim_get_option_value('winwidth', {}) -- Set winwidth=1 so that window sizes don't change. - meths.set_option_value('winwidth', 1, {}) + meths.nvim_set_option_value('winwidth', 1, {}) command('tabedit') - local tabpage = meths.get_current_tabpage() + local tabpage = meths.nvim_get_current_tabpage() insert('hello') command('vsplit') local opts = { @@ -1651,18 +1651,18 @@ describe('ui/mouse/input', function() border = 'single', focusable = 1, } - local float = meths.open_win(meths.get_current_buf(), false, opts) + local float = meths.nvim_open_win(meths.nvim_get_current_buf(), false, opts) command('redraw') - local lines = meths.get_option_value('lines', {}) - local columns = meths.get_option_value('columns', {}) + local lines = meths.nvim_get_option_value('lines', {}) + local columns = meths.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.input_mouse('left', 'press', '', 0, row, col) - meths.set_current_tabpage(tabpage) + meths.nvim_input_mouse('left', 'press', '', 0, row, col) + meths.nvim_set_current_tabpage(tabpage) local mousepos = funcs.getmousepos() eq(row + 1, mousepos.screenrow) eq(col + 1, mousepos.screencol) @@ -1686,7 +1686,7 @@ 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.input_mouse('left', 'press', '', 0, row, col) + meths.nvim_input_mouse('left', 'press', '', 0, row, col) local mousepos = funcs.getmousepos() eq(float.id, mousepos.winid) eq(win_row + 1, mousepos.winrow) @@ -1715,13 +1715,13 @@ 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.win_set_config(float, opts) + meths.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.input_mouse('left', 'press', '', 0, row, col) + meths.nvim_input_mouse('left', 'press', '', 0, row, col) local mousepos = funcs.getmousepos() eq(float.id, mousepos.winid) eq(win_row + 1, mousepos.winrow) @@ -1740,14 +1740,14 @@ describe('ui/mouse/input', function() -- that getmousepos() does not consider unfocusable floats. (see discussion -- in PR #14937 for details). opts.focusable = false - meths.win_set_config(float, opts) + meths.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.input_mouse('left', 'press', '', 0, row, col) + meths.nvim_input_mouse('left', 'press', '', 0, row, col) local mousepos = funcs.getmousepos() eq(funcs.win_getid(nr), mousepos.winid) eq(win_row + 1, mousepos.winrow) @@ -1764,34 +1764,34 @@ describe('ui/mouse/input', function() -- Restore state and release mouse. command('tabclose!') - meths.set_option_value('winwidth', winwidth, {}) - meths.input_mouse('left', 'release', '', 0, 0, 0) + meths.nvim_set_option_value('winwidth', winwidth, {}) + meths.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.set_var('mouse_up', 0) - meths.set_var('mouse_up2', 0) + meths.nvim_set_var('mouse_up', 0) + meths.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.input_mouse('wheel', 'up', '', 0, 0, 0) - meths.input_mouse('wheel', 'up', '', 0, 0, 0) - eq(4, meths.get_var('mouse_up')) - eq(0, meths.get_var('mouse_up2')) + 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')) end) it('<MouseMove> is not translated into multiclicks and can be mapped', function() - meths.set_var('mouse_move', 0) - meths.set_var('mouse_move2', 0) + meths.nvim_set_var('mouse_move', 0) + meths.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.input_mouse('move', '', '', 0, 0, 0) - meths.input_mouse('move', '', '', 0, 0, 0) - eq(4, meths.get_var('mouse_move')) - eq(0, meths.get_var('mouse_move2')) + 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')) end) it('feeding <MouseMove> in Normal mode does not use uninitialized memory #19480', function() @@ -1818,102 +1818,102 @@ describe('ui/mouse/input', function() vmenu PopUp.baz y:<C-U>let g:menustr = 'baz'<CR> ]]) - meths.win_set_cursor(0, { 1, 0 }) - meths.input_mouse('right', 'press', '', 0, 0, 4) - meths.input_mouse('right', 'release', '', 0, 0, 4) + 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) feed('<Down><Down><CR>') - eq('bar', meths.get_var('menustr')) - eq({ 1, 4 }, meths.win_get_cursor(0)) + eq('bar', meths.nvim_get_var('menustr')) + eq({ 1, 4 }, meths.nvim_win_get_cursor(0)) -- Test for right click in visual mode inside the selection funcs.setreg('"', '') - meths.win_set_cursor(0, { 1, 9 }) + meths.nvim_win_set_cursor(0, { 1, 9 }) feed('vee') - meths.input_mouse('right', 'press', '', 0, 0, 11) - meths.input_mouse('right', 'release', '', 0, 0, 11) + meths.nvim_input_mouse('right', 'press', '', 0, 0, 11) + meths.nvim_input_mouse('right', 'release', '', 0, 0, 11) feed('<Down><CR>') - eq({ 1, 9 }, meths.win_get_cursor(0)) + eq({ 1, 9 }, meths.nvim_win_get_cursor(0)) eq('ran away', funcs.getreg('"')) -- Test for right click in visual mode right before the selection funcs.setreg('"', '') - meths.win_set_cursor(0, { 1, 9 }) + meths.nvim_win_set_cursor(0, { 1, 9 }) feed('vee') - meths.input_mouse('right', 'press', '', 0, 0, 8) - meths.input_mouse('right', 'release', '', 0, 0, 8) + meths.nvim_input_mouse('right', 'press', '', 0, 0, 8) + meths.nvim_input_mouse('right', 'release', '', 0, 0, 8) feed('<Down><CR>') - eq({ 1, 8 }, meths.win_get_cursor(0)) + eq({ 1, 8 }, meths.nvim_win_get_cursor(0)) eq('', funcs.getreg('"')) -- Test for right click in visual mode right after the selection funcs.setreg('"', '') - meths.win_set_cursor(0, { 1, 9 }) + meths.nvim_win_set_cursor(0, { 1, 9 }) feed('vee') - meths.input_mouse('right', 'press', '', 0, 0, 17) - meths.input_mouse('right', 'release', '', 0, 0, 17) + meths.nvim_input_mouse('right', 'press', '', 0, 0, 17) + meths.nvim_input_mouse('right', 'release', '', 0, 0, 17) feed('<Down><CR>') - eq({ 1, 17 }, meths.win_get_cursor(0)) + eq({ 1, 17 }, meths.nvim_win_get_cursor(0)) eq('', funcs.getreg('"')) -- Test for right click in block-wise visual mode inside the selection funcs.setreg('"', '') - meths.win_set_cursor(0, { 1, 15 }) + meths.nvim_win_set_cursor(0, { 1, 15 }) feed('<C-V>j3l') - meths.input_mouse('right', 'press', '', 0, 1, 16) - meths.input_mouse('right', 'release', '', 0, 1, 16) + meths.nvim_input_mouse('right', 'press', '', 0, 1, 16) + meths.nvim_input_mouse('right', 'release', '', 0, 1, 16) feed('<Down><CR>') - eq({ 1, 15 }, meths.win_get_cursor(0)) + eq({ 1, 15 }, meths.nvim_win_get_cursor(0)) eq('\0224', funcs.getregtype('"')) -- Test for right click in block-wise visual mode outside the selection funcs.setreg('"', '') - meths.win_set_cursor(0, { 1, 15 }) + meths.nvim_win_set_cursor(0, { 1, 15 }) feed('<C-V>j3l') - meths.input_mouse('right', 'press', '', 0, 1, 1) - meths.input_mouse('right', 'release', '', 0, 1, 1) + meths.nvim_input_mouse('right', 'press', '', 0, 1, 1) + meths.nvim_input_mouse('right', 'release', '', 0, 1, 1) feed('<Down><CR>') - eq({ 2, 1 }, meths.win_get_cursor(0)) + eq({ 2, 1 }, meths.nvim_win_get_cursor(0)) eq('v', funcs.getregtype('"')) eq('', funcs.getreg('"')) -- Test for right click in line-wise visual mode inside the selection funcs.setreg('"', '') - meths.win_set_cursor(0, { 1, 15 }) + meths.nvim_win_set_cursor(0, { 1, 15 }) feed('V') - meths.input_mouse('right', 'press', '', 0, 0, 9) - meths.input_mouse('right', 'release', '', 0, 0, 9) + meths.nvim_input_mouse('right', 'press', '', 0, 0, 9) + meths.nvim_input_mouse('right', 'release', '', 0, 0, 9) feed('<Down><CR>') - eq({ 1, 0 }, meths.win_get_cursor(0)) -- After yanking, the cursor goes to 1,1 + 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)) -- Test for right click in multi-line line-wise visual mode inside the selection funcs.setreg('"', '') - meths.win_set_cursor(0, { 1, 15 }) + meths.nvim_win_set_cursor(0, { 1, 15 }) feed('Vj') - meths.input_mouse('right', 'press', '', 0, 1, 19) - meths.input_mouse('right', 'release', '', 0, 1, 19) + meths.nvim_input_mouse('right', 'press', '', 0, 1, 19) + meths.nvim_input_mouse('right', 'release', '', 0, 1, 19) feed('<Down><CR>') - eq({ 1, 0 }, meths.win_get_cursor(0)) -- After yanking, the cursor goes to 1,1 + 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)) -- Test for right click in line-wise visual mode outside the selection funcs.setreg('"', '') - meths.win_set_cursor(0, { 1, 15 }) + meths.nvim_win_set_cursor(0, { 1, 15 }) feed('V') - meths.input_mouse('right', 'press', '', 0, 1, 9) - meths.input_mouse('right', 'release', '', 0, 1, 9) + meths.nvim_input_mouse('right', 'press', '', 0, 1, 9) + meths.nvim_input_mouse('right', 'release', '', 0, 1, 9) feed('<Down><CR>') - eq({ 2, 9 }, meths.win_get_cursor(0)) + eq({ 2, 9 }, meths.nvim_win_get_cursor(0)) eq('', funcs.getreg('"')) -- Try clicking outside the window funcs.setreg('"', '') - meths.win_set_cursor(0, { 2, 1 }) + meths.nvim_win_set_cursor(0, { 2, 1 }) feed('vee') - meths.input_mouse('right', 'press', '', 0, 6, 1) - meths.input_mouse('right', 'release', '', 0, 6, 1) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 1) + meths.nvim_input_mouse('right', 'release', '', 0, 6, 1) feed('<Down><CR>') eq(2, funcs.winnr()) eq('', funcs.getreg('"')) @@ -1922,12 +1922,12 @@ describe('ui/mouse/input', function() command('wincmd t') command('rightbelow vsplit') funcs.setreg('"', '') - meths.win_set_cursor(0, { 1, 9 }) + meths.nvim_win_set_cursor(0, { 1, 9 }) feed('vee') - meths.input_mouse('right', 'press', '', 0, 0, 52) - meths.input_mouse('right', 'release', '', 0, 0, 52) + meths.nvim_input_mouse('right', 'press', '', 0, 0, 52) + meths.nvim_input_mouse('right', 'release', '', 0, 0, 52) feed('<Down><CR>') - eq({ 1, 9 }, meths.win_get_cursor(0)) + eq({ 1, 9 }, meths.nvim_win_get_cursor(0)) eq('ran away', funcs.getreg('"')) -- Test for right click inside visual selection at bottom of window with winbar @@ -1935,10 +1935,10 @@ describe('ui/mouse/input', function() feed('2yyP') funcs.setreg('"', '') feed('G$vbb') - meths.input_mouse('right', 'press', '', 0, 4, 61) - meths.input_mouse('right', 'release', '', 0, 4, 61) + meths.nvim_input_mouse('right', 'press', '', 0, 4, 61) + meths.nvim_input_mouse('right', 'release', '', 0, 4, 61) feed('<Down><CR>') - eq({ 4, 20 }, meths.win_get_cursor(0)) + eq({ 4, 20 }, meths.nvim_win_get_cursor(0)) eq('the moon', funcs.getreg('"')) end) end) diff --git a/test/functional/ui/multibyte_spec.lua b/test/functional/ui/multibyte_spec.lua index bb65ea4cc4..72bb0b0174 100644 --- a/test/functional/ui/multibyte_spec.lua +++ b/test/functional/ui/multibyte_spec.lua @@ -118,7 +118,7 @@ describe('multibyte rendering', function() it('works with a lot of unicode (zalgo) text', function() screen:try_resize(65, 10) - meths.buf_set_lines( + meths.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._invalidate_glyph_cache() + meths.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.buf_set_lines(0, 0, -1, true, { 'سلام့̀́̂̃̄̅̆̇̈̉̊̋̌' }) + meths.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 0253b28cd5..094e27e69a 100644 --- a/test/functional/ui/multigrid_spec.lua +++ b/test/functional/ui/multigrid_spec.lua @@ -462,9 +462,9 @@ describe('ext_multigrid', function() end) it("'scroll' option works properly", function() - eq(10, meths.get_option_value('scroll', { win = 0 })) - meths.set_option_value('scroll', 15, { win = 0 }) - eq(15, meths.get_option_value('scroll', { win = 0 })) + 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 })) end) it('gets written till grid width', function() @@ -592,8 +592,8 @@ describe('ext_multigrid', function() ## grid 3 | ]]} - local float_buf = meths.create_buf(false, false) - meths.open_win(float_buf, false, { + local float_buf = meths.nvim_create_buf(false, false) + meths.nvim_open_win(float_buf, false, { relative = 'win', win = curwin(), bufpos = {0, 1018}, @@ -984,7 +984,7 @@ describe('ext_multigrid', function() | ]]} - meths.input_mouse('left', 'press', '', 2, 0, 5) + meths.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.input_mouse('left', 'press', '', 2, 1, 6) + meths.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.input_mouse('left', 'press', '', 4, 1, 4) + meths.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.input_mouse('left', 'press', '', 4, 0, 64) + meths.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.input_mouse('left', 'press', '', 1, 6, 20) + meths.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.input_mouse('left', 'drag', '', 1, 4, 20) + meths.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.input_mouse('left', 'press', '', 1, 8, 26) + meths.nvim_input_mouse('left', 'press', '', 1, 8, 26) poke_eventloop() - meths.input_mouse('left', 'drag', '', 1, 6, 30) + meths.nvim_input_mouse('left', 'drag', '', 1, 6, 30) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -1174,7 +1174,7 @@ describe('ext_multigrid', function() command('aunmenu PopUp | vmenu PopUp.Copy y') funcs.setreg('"', '') - meths.input_mouse('left', 'press', '2', 2, 1, 6) + meths.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.input_mouse('right', 'press', '', 2, 1, 6) - meths.input_mouse('right', 'release', '', 2, 1, 6) + meths.nvim_input_mouse('right', 'press', '', 2, 1, 6) + meths.nvim_input_mouse('right', 'release', '', 2, 1, 6) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -1248,7 +1248,7 @@ describe('ext_multigrid', function() eq('clicked', funcs.getreg('"')) funcs.setreg('"', '') - meths.input_mouse('left', 'press', '2', 4, 0, 64) + meths.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.input_mouse('right', 'press', '', 4, 0, 64) - meths.input_mouse('right', 'release', '', 4, 0, 64) + meths.nvim_input_mouse('right', 'press', '', 4, 0, 64) + meths.nvim_input_mouse('right', 'release', '', 4, 0, 64) screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]|*4 @@ -1354,7 +1354,7 @@ describe('ext_multigrid', function() ]]} funcs.setreg('"', '') - meths.input_mouse('left', 'press', '2', 4, 9, 1) + meths.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.input_mouse('right', 'press', '', 4, 9, 1) - meths.input_mouse('right', 'release', '', 4, 9, 1) + meths.nvim_input_mouse('right', 'press', '', 4, 9, 1) + meths.nvim_input_mouse('right', 'release', '', 4, 9, 1) screen:expect{grid=[[ ## grid 1 [5:------------------------------]│[2:----------------------]|*5 @@ -1484,7 +1484,7 @@ describe('ext_multigrid', function() ]]} funcs.setreg('"', '') - meths.input_mouse('left', 'press', '2', 4, 9, 1) + meths.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.input_mouse('right', 'press', '', 4, 9, 1) - meths.input_mouse('right', 'release', '', 4, 9, 1) + meths.nvim_input_mouse('right', 'press', '', 4, 9, 1) + meths.nvim_input_mouse('right', 'release', '', 4, 9, 1) screen:expect{grid=[[ ## grid 1 [5:------------------------------]│[2:----------------------]|*5 @@ -1593,9 +1593,9 @@ describe('ext_multigrid', function() command('enew') feed('ifoo\nbar<esc>') - meths.input_mouse('left', 'press', '', 5, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 5, 0, 0) poke_eventloop() - meths.input_mouse('left', 'drag', '', 5, 1, 2) + meths.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.win_set_cursor(1000, {1, 10}) + meths.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.input_mouse('left', 'press', '', 1,5, 1) + meths.nvim_input_mouse('left', 'press', '', 1,5, 1) poke_eventloop() - meths.input_mouse('left', 'drag', '', 1, 6, 1) + meths.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.set_option_value('winbar', 'Set Up The Bars', {}) + meths.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.input_mouse('left', 'press', '', 1, 6, 20) + meths.nvim_input_mouse('left', 'press', '', 1, 6, 20) poke_eventloop() - meths.input_mouse('left', 'drag', '', 1, 7, 20) + meths.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.input_mouse('left', 'drag', '', 1, 4, 20) + meths.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.input_mouse('left', 'press', '', 1, 12, 10) + meths.nvim_input_mouse('left', 'press', '', 1, 12, 10) poke_eventloop() - meths.input_mouse('left', 'drag', '', 1, 10, 10) + meths.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.get_option_value('cmdheight', {})) + eq(3, meths.nvim_get_option_value('cmdheight', {})) - meths.input_mouse('left', 'drag', '', 1, 12, 10) + meths.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.get_option_value('cmdheight', {})) + eq(1, meths.nvim_get_option_value('cmdheight', {})) end) end) diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 94b4ead434..b4cfe39bc3 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -117,7 +117,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.select_popupmenu_item(1, false, false, {}) + meths.nvim_select_popupmenu_item(1, false, false, {}) screen:expect { grid = [[ | @@ -132,7 +132,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.select_popupmenu_item(2, true, false, {}) + meths.nvim_select_popupmenu_item(2, true, false, {}) screen:expect { grid = [[ | @@ -147,7 +147,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.select_popupmenu_item(0, true, true, {}) + meths.nvim_select_popupmenu_item(0, true, true, {}) screen:expect([[ | foo^ | @@ -170,7 +170,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.select_popupmenu_item(-1, false, false, {}) + meths.nvim_select_popupmenu_item(-1, false, false, {}) screen:expect { grid = [[ | @@ -185,7 +185,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.select_popupmenu_item(1, true, false, {}) + meths.nvim_select_popupmenu_item(1, true, false, {}) screen:expect { grid = [[ | @@ -200,7 +200,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.select_popupmenu_item(-1, true, false, {}) + meths.nvim_select_popupmenu_item(-1, true, false, {}) screen:expect { grid = [[ | @@ -215,7 +215,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.select_popupmenu_item(0, true, false, {}) + meths.nvim_select_popupmenu_item(0, true, false, {}) screen:expect { grid = [[ | @@ -230,7 +230,7 @@ describe('ui/ext_popupmenu', function() }, } - meths.select_popupmenu_item(-1, true, true, {}) + meths.nvim_select_popupmenu_item(-1, true, true, {}) screen:expect([[ | ^ | @@ -262,7 +262,7 @@ describe('ui/ext_popupmenu', function() }, }) - meths.select_popupmenu_item(-1, true, false, {}) + meths.nvim_select_popupmenu_item(-1, true, false, {}) screen:expect({ grid = [[ |*2 @@ -276,7 +276,7 @@ describe('ui/ext_popupmenu', function() }, }) - meths.select_popupmenu_item(5, true, false, {}) + meths.nvim_select_popupmenu_item(5, true, false, {}) screen:expect({ grid = [[ |*2 @@ -290,7 +290,7 @@ describe('ui/ext_popupmenu', function() }, }) - meths.select_popupmenu_item(-1, true, true, {}) + meths.nvim_select_popupmenu_item(-1, true, true, {}) screen:expect({ grid = [[ |*2 @@ -313,7 +313,7 @@ describe('ui/ext_popupmenu', function() }, }) - meths.select_popupmenu_item(5, true, true, {}) + meths.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.ui_pum_set_height(pum_height) + meths.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.ui_pum_set_height(1) - eq('Expected pum height > 0', pcall_err(meths.ui_pum_set_height, 0)) + meths.nvim_ui_pum_set_height(1) + eq('Expected pum height > 0', pcall_err(meths.nvim_ui_pum_set_height, 0)) end) it('an error occurs when ext_popupmenu is false', function() - meths.ui_pum_set_height(1) + meths.nvim_ui_pum_set_height(1) screen:set_option('ext_popupmenu', false) - eq('It must support the ext_popupmenu option', pcall_err(meths.ui_pum_set_height, 1)) + eq('It must support the ext_popupmenu option', pcall_err(meths.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.ui_pum_set_height(pum_height) + meths.nvim_ui_pum_set_height(pum_height) -- set bounds w h r c - meths.ui_pum_set_bounds(10.5, 5.2, 6.3, 7.4) + meths.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.ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5) - meths.ui_pum_set_bounds(1.0, 1.0, -1.0, 0.0) - meths.ui_pum_set_bounds(1.0, 1.0, 0.0, -1.0) + 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) end) it('an error occurs if width or height set 0 or less', function() - meths.ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5) - eq('Expected width > 0', pcall_err(meths.ui_pum_set_bounds, 0.0, 1.0, 1.0, 0.0)) - eq('Expected height > 0', pcall_err(meths.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.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)) end) it('an error occurs when ext_popupmenu is false', function() - meths.ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5) + meths.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.ui_pum_set_bounds, 1.0, 1.0, 0.0, 1.5) + pcall_err(meths.nvim_ui_pum_set_bounds, 1.0, 1.0, 0.0, 1.5) ) end) end) @@ -1055,7 +1055,7 @@ describe("builtin popupmenu 'pumblend'", function() {20:-- Keyword Local completion (^N^P) }{21:match 1 of 65} | ]]) - meths.input_mouse('wheel', 'down', '', 0, 9, 40) + meths.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.input_mouse('wheel', 'down', '', 0, 9, 40) + meths.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.input_mouse('wheel', 'up', '', 0, 9, 40) + meths.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.input_mouse('wheel', 'down', '', 0, 9, 40) + meths.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.input_mouse('wheel', 'down', '', 0, 9, 40) + meths.nvim_input_mouse('wheel', 'down', '', 0, 9, 40) screen:expect([[ Est eu^ | L{n: elit } sit amet, consectetur | @@ -2663,7 +2663,7 @@ describe('builtin popupmenu', function() {2:-- INSERT --} | ]]) - meths.input_mouse('wheel', 'down', '', 0, 6, 15) + meths.nvim_input_mouse('wheel', 'down', '', 0, 6, 15) screen:expect { grid = [[ xx | @@ -3347,7 +3347,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.buf_set_lines(0, 0, -1, true, { ('a'):rep(100) }) + meths.nvim_buf_set_lines(0, 0, -1, true, { ('a'):rep(100) }) command('set wildoptions+=pum') feed('$') feed(':sign <Tab>') @@ -3631,7 +3631,7 @@ describe('builtin popupmenu', function() ]]) if multigrid then - meths.input_mouse('right', 'press', '', 2, 0, 4) + meths.nvim_input_mouse('right', 'press', '', 2, 0, 4) screen:expect({ grid = [[ ## grid 1 @@ -3739,10 +3739,10 @@ describe('builtin popupmenu', function() :let g:menustr = 'bar' | ]]) end - eq('bar', meths.get_var('menustr')) + eq('bar', meths.nvim_get_var('menustr')) if multigrid then - meths.input_mouse('right', 'press', '', 2, 2, 20) + meths.nvim_input_mouse('right', 'press', '', 2, 2, 20) screen:expect({ grid = [[ ## grid 1 @@ -3771,7 +3771,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.input_mouse('right', 'press', '', 2, 0, 18) + meths.nvim_input_mouse('right', 'press', '', 2, 0, 18) screen:expect { grid = [[ ## grid 1 @@ -3803,7 +3803,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.input_mouse('right', 'press', '', 4, 1, 3) + meths.nvim_input_mouse('right', 'press', '', 4, 1, 3) screen:expect({ grid = [[ ## grid 1 @@ -3832,7 +3832,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 2) + meths.nvim_input_mouse('left', 'press', '', 4, 2, 2) screen:expect({ grid = [[ ## grid 1 @@ -3853,10 +3853,10 @@ describe('builtin popupmenu', function() :let g:menustr = 'baz' | ]]) end - eq('baz', meths.get_var('menustr')) + eq('baz', meths.nvim_get_var('menustr')) if multigrid then - meths.input_mouse('right', 'press', '', 2, 0, 4) + meths.nvim_input_mouse('right', 'press', '', 2, 0, 4) screen:expect({ grid = [[ ## grid 1 @@ -3886,7 +3886,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.input_mouse('right', 'drag', '', 2, 3, 6) + meths.nvim_input_mouse('right', 'drag', '', 2, 3, 6) screen:expect({ grid = [[ ## grid 1 @@ -3916,7 +3916,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.input_mouse('right', 'release', '', 2, 1, 6) + meths.nvim_input_mouse('right', 'release', '', 2, 1, 6) screen:expect({ grid = [[ ## grid 1 @@ -3937,11 +3937,11 @@ describe('builtin popupmenu', function() :let g:menustr = 'foo' | ]]) end - eq('foo', meths.get_var('menustr')) + eq('foo', meths.nvim_get_var('menustr')) eq(false, screen.options.mousemoveevent) if multigrid then - meths.input_mouse('right', 'press', '', 2, 0, 4) + meths.nvim_input_mouse('right', 'press', '', 2, 0, 4) screen:expect({ grid = [[ ## grid 1 @@ -3972,7 +3972,7 @@ describe('builtin popupmenu', function() end eq(true, screen.options.mousemoveevent) if multigrid then - meths.input_mouse('move', '', '', 2, 3, 6) + meths.nvim_input_mouse('move', '', '', 2, 3, 6) screen:expect({ grid = [[ ## grid 1 @@ -4003,7 +4003,7 @@ describe('builtin popupmenu', function() end eq(true, screen.options.mousemoveevent) if multigrid then - meths.input_mouse('left', 'press', '', 2, 2, 6) + meths.nvim_input_mouse('left', 'press', '', 2, 2, 6) screen:expect({ grid = [[ ## grid 1 @@ -4025,11 +4025,11 @@ describe('builtin popupmenu', function() ]]) end eq(false, screen.options.mousemoveevent) - eq('bar', meths.get_var('menustr')) + eq('bar', meths.nvim_get_var('menustr')) command('set laststatus=0 | botright split') if multigrid then - meths.input_mouse('right', 'press', '', 5, 1, 20) + meths.nvim_input_mouse('right', 'press', '', 5, 1, 20) screen:expect({ grid = [[ ## grid 1 @@ -4064,7 +4064,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.input_mouse('left', 'press', '', 4, 2, 2) + meths.nvim_input_mouse('left', 'press', '', 4, 2, 2) screen:expect({ grid = [[ ## grid 1 @@ -4093,11 +4093,11 @@ describe('builtin popupmenu', function() :let g:menustr = 'baz' | ]]) end - eq('baz', meths.get_var('menustr')) + eq('baz', meths.nvim_get_var('menustr')) command('set winwidth=1 | rightbelow vsplit') if multigrid then - meths.input_mouse('right', 'press', '', 6, 1, 14) + meths.nvim_input_mouse('right', 'press', '', 6, 1, 14) screen:expect({ grid = [[ ## grid 1 @@ -4135,7 +4135,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.input_mouse('left', 'press', '', 4, 0, 2) + meths.nvim_input_mouse('left', 'press', '', 4, 0, 2) screen:expect({ grid = [[ ## grid 1 @@ -4167,11 +4167,11 @@ describe('builtin popupmenu', function() :let g:menustr = 'foo' | ]]) end - eq('foo', meths.get_var('menustr')) + eq('foo', meths.nvim_get_var('menustr')) command('setlocal winbar=WINBAR') if multigrid then - meths.input_mouse('right', 'press', '', 6, 1, 14) + meths.nvim_input_mouse('right', 'press', '', 6, 1, 14) screen:expect({ grid = [[ ## grid 1 @@ -4209,7 +4209,7 @@ describe('builtin popupmenu', function() ]]) end if multigrid then - meths.input_mouse('left', 'press', '', 4, 1, 2) + meths.nvim_input_mouse('left', 'press', '', 4, 1, 2) screen:expect({ grid = [[ ## grid 1 @@ -4241,7 +4241,7 @@ describe('builtin popupmenu', function() :let g:menustr = 'bar' | ]]) end - eq('bar', meths.get_var('menustr')) + eq('bar', meths.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 612a2a947d..f8475acb68 100644 --- a/test/functional/ui/quickfix_spec.lua +++ b/test/functional/ui/quickfix_spec.lua @@ -26,7 +26,7 @@ describe('quickfix selection highlight', function() [12] = { foreground = Screen.colors.Brown, background = Screen.colors.Fuchsia }, }) - meths.set_option_value('errorformat', '%m %l', {}) + meths.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 4ee2438f88..3089690f0a 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -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.set_option_value('showtabline', 2, {}) + meths.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.get_var('echospace')) + eq(29, meths.nvim_get_var('echospace')) end) it('messages from the same Ex command as resize are visible #22225', function() @@ -779,9 +779,9 @@ 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.get_option_value('lines', {})) - eq(99, meths.get_option_value('window', {})) - eq(99, meths.win_get_height(0)) + eq(100, meths.nvim_get_option_value('lines', {})) + eq(99, meths.nvim_get_option_value('window', {})) + eq(99, meths.nvim_win_get_height(0)) feed('1000o<Esc>') eq(903, funcs.line('w0')) feed('<C-B>') @@ -794,9 +794,9 @@ it('CTRL-F or CTRL-B scrolls a page after UI attach/resize #20605', function() eq(903, funcs.line('w0')) feed('G') screen:try_resize(50, 50) - eq(50, meths.get_option_value('lines', {})) - eq(49, meths.get_option_value('window', {})) - eq(49, meths.win_get_height(0)) + 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')) feed('<C-B>') eq(906, funcs.line('w0')) diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index 53fa4b6d65..cade21a3e4 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -423,7 +423,7 @@ describe('Signs', function() {0:~ }|*7 | ]]) - meths.buf_set_extmark(0, meths.create_namespace('test'), 0, 0, { + meths.nvim_buf_set_extmark(0, meths.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.buf_set_lines(0, 0, 1, true, { 'a', 'b', 'c', 'd', 'e' }) + meths.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.buf_set_lines(0, 0, 1, true, { 'a', 'b', 'c', 'd', 'e' }) + meths.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 13c3b24cc1..c9730cee97 100644 --- a/test/functional/ui/spell_spec.lua +++ b/test/functional/ui/spell_spec.lua @@ -260,7 +260,7 @@ describe("'spell'", function() {6:search hit BOTTOM, continuing at TOP} | ]]) exec('echo ""') - local ns = meths.create_namespace('spell') + local ns = meths.nvim_create_namespace('spell') -- extmark with spell=true enables spell local id = curbufmeths.set_extmark(ns, 1, 4, { end_row = 1, end_col = 10, spell = true }) screen:expect([[ @@ -368,7 +368,7 @@ describe("'spell'", function() syntax match Constant "^.*$" call setline(1, "This is some text without any spell errors.") ]]) - local ns = meths.create_namespace('spell') + local ns = meths.nvim_create_namespace('spell') curbufmeths.set_extmark(ns, 0, 0, { hl_group = 'WarningMsg', end_col = 43 }) screen:expect([[ {6:^This is some text without any spell errors.}| diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index a27524c9f2..7e0ba85500 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -543,56 +543,60 @@ describe('statuscolumn', function() end) it('clicks work with mousemodel=' .. model, function() - meths.set_option_value('statuscolumn', '%0@MyClickFunc@%=%l%T', {}) - meths.input_mouse('left', 'press', '', 0, 0, 0) + meths.nvim_set_option_value('statuscolumn', '%0@MyClickFunc@%=%l%T', {}) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) eq('0 1 l 4', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) eq('0 2 l 4', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) eq('0 3 l 4', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) eq('0 4 l 4', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 3, 0) + meths.nvim_input_mouse('right', 'press', '', 0, 3, 0) eq('0 1 r 7', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 3, 0) + meths.nvim_input_mouse('right', 'press', '', 0, 3, 0) eq('0 2 r 7', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 3, 0) + meths.nvim_input_mouse('right', 'press', '', 0, 3, 0) eq('0 3 r 7', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 3, 0) + meths.nvim_input_mouse('right', 'press', '', 0, 3, 0) eq('0 4 r 7', eval('g:testvar')) command('rightbelow vsplit') - meths.input_mouse('left', 'press', '', 0, 0, 27) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 27) eq('0 1 l 4', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 3, 27) + meths.nvim_input_mouse('right', 'press', '', 0, 3, 27) eq('0 1 r 7', eval('g:testvar')) command('setlocal rightleft') - meths.input_mouse('left', 'press', '', 0, 0, 52) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 52) eq('0 1 l 4', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 3, 52) + meths.nvim_input_mouse('right', 'press', '', 0, 3, 52) eq('0 1 r 7', eval('g:testvar')) command('wincmd H') - meths.input_mouse('left', 'press', '', 0, 0, 25) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 25) eq('0 1 l 4', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 3, 25) + meths.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.input_mouse('right', 'press', '', 0, 0, 0) + meths.nvim_input_mouse('right', 'press', '', 0, 0, 0) eq('', eval('g:testvar')) -- Check that statusline click doesn't register as statuscolumn click - meths.input_mouse('right', 'press', '', 0, 12, 0) + meths.nvim_input_mouse('right', 'press', '', 0, 12, 0) eq('', eval('g:testvar')) -- Check that cmdline click doesn't register as statuscolumn click - meths.input_mouse('right', 'press', '', 0, 13, 0) + meths.nvim_input_mouse('right', 'press', '', 0, 13, 0) eq('', eval('g:testvar')) end) it('clicks and highlights work with control characters', function() - meths.set_option_value('statuscolumn', '\t%#NonText#\1%0@MyClickFunc@\t\1%T\t%##\1', {}) + meths.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 @@ -605,13 +609,13 @@ describe('statuscolumn', function() [1] = { foreground = Screen.colors.Brown }, -- LineNr }, } - meths.input_mouse('right', 'press', '', 0, 4, 3) + meths.nvim_input_mouse('right', 'press', '', 0, 4, 3) eq('', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 5, 8) + meths.nvim_input_mouse('left', 'press', '', 0, 5, 8) eq('', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 4) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 4) eq('0 1 r 10', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 7, 7) + meths.nvim_input_mouse('left', 'press', '', 0, 7, 7) eq('0 1 l 11', eval('g:testvar')) end) @@ -621,7 +625,7 @@ describe('statuscolumn', function() [0] = { foreground = Screen.colors.Brown }, [1] = { background = Screen.colors.Plum1 }, }) - meths.set_option_value('statuscolumn', '%0@MyClickFunc@%l%T', {}) + meths.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) @@ -630,26 +634,26 @@ describe('statuscolumn', function() endfunction ]]) -- clicking an item does not drag mouse - meths.input_mouse('left', 'press', '', 0, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ {0:8 }^aaaaa | {1: Echo } | ]]) - meths.input_mouse('left', 'press', '', 0, 1, 5) - meths.input_mouse('left', 'release', '', 0, 1, 5) + meths.nvim_input_mouse('left', 'press', '', 0, 1, 5) + meths.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.input_mouse('left', 'press', '', 0, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ {0:8 }^aaaaa | {1: Echo } | ]]) - meths.input_mouse('left', 'press', '', 0, 0, 10) - meths.input_mouse('left', 'release', '', 0, 0, 10) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 10) + meths.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 7e6d336ff9..2d39312ea2 100644 --- a/test/functional/ui/statusline_spec.lua +++ b/test/functional/ui/statusline_spec.lua @@ -39,31 +39,35 @@ for _, model in ipairs(mousemodels) do end) it('works', function() - meths.set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) - meths.input_mouse('left', 'press', '', 0, 6, 16) + meths.nvim_set_option_value( + 'statusline', + 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', + {} + ) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 16) eq('', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 29) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 29) eq('', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 1 l', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 2 l', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 3 l', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 4 l', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 28) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 28) eq('0 1 r', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 28) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 28) eq('0 2 r', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 28) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 28) eq('0 3 r', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 28) + meths.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.set_option_value('statusline', '\t%#NonText#\1%0@MyClickFunc@\t\1%T\t%##\1', {}) + meths.nvim_set_option_value('statusline', '\t%#NonText#\1%0@MyClickFunc@\t\1%T\t%##\1', {}) screen:expect { grid = [[ ^ | @@ -72,50 +76,54 @@ for _, model in ipairs(mousemodels) do | ]], } - meths.input_mouse('right', 'press', '', 0, 6, 3) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 3) eq('', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 6, 8) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 8) eq('', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 4) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 4) eq('0 1 r', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 6, 7) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 7) eq('0 1 l', eval('g:testvar')) end) it('works for winbar', function() - meths.set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) - meths.input_mouse('left', 'press', '', 0, 0, 17) + meths.nvim_set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 17) eq('0 1 l', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 0, 17) + meths.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.open_win( + meths.nvim_open_win( 0, true, { width = 30, height = 4, relative = 'editor', row = 1, col = 5, border = 'single' } ) - meths.set_option_value( + meths.nvim_set_option_value( 'winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', { scope = 'local' } ) - meths.input_mouse('left', 'press', '', 0, 2, 23) + meths.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.set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) - meths.set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) - meths.input_mouse('left', 'press', '', 0, 0, 17) + 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) eq('0 1 l', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 4, 17) + meths.nvim_input_mouse('right', 'press', '', 0, 4, 17) eq('0 1 r', eval('g:testvar')) - meths.input_mouse('middle', 'press', '', 0, 3, 17) + meths.nvim_input_mouse('middle', 'press', '', 0, 3, 17) eq('0 1 m', eval('g:testvar')) - meths.input_mouse('left', 'press', '', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 17) eq('0 1 l', eval('g:testvar')) end) @@ -125,64 +133,72 @@ for _, model in ipairs(mousemodels) do vim.g.testvar = string.format("%d %d %s", minwid, clicks, button) end ]]) - meths.set_option_value( + meths.nvim_set_option_value( 'statusline', 'Not clicky stuff %0@v:lua.clicky_func@Clicky stuff%T', {} ) - meths.input_mouse('left', 'press', '', 0, 6, 17) + meths.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.set_option_value('statusline', '%2TNot clicky stuff%T', {}) - meths.input_mouse('left', 'press', '', 0, 6, 0) - eq(1, meths.get_current_tabpage().id) - meths.set_option_value('statusline', '%2XNot clicky stuff%X', {}) - meths.input_mouse('left', 'press', '', 0, 6, 0) - eq(2, #meths.list_tabpages()) + 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()) end) it("right click works when statusline isn't focused #18994", function() - meths.set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) - meths.input_mouse('right', 'press', '', 0, 6, 17) + meths.nvim_set_option_value( + 'statusline', + 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', + {} + ) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 17) eq('0 1 r', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 17) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 17) eq('0 2 r', eval('g:testvar')) end) it('works with modifiers #18994', function() - meths.set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {}) + meths.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.input_mouse('left', 'press', 'S', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', 'S', 0, 6, 17) eq('0 1 l(s )', eval('g:testvar')) - meths.input_mouse('right', 'press', 'S', 0, 6, 17) + meths.nvim_input_mouse('right', 'press', 'S', 0, 6, 17) eq('0 1 r(s )', eval('g:testvar')) - meths.input_mouse('left', 'press', 'A', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', 'A', 0, 6, 17) eq('0 1 l( a )', eval('g:testvar')) - meths.input_mouse('right', 'press', 'A', 0, 6, 17) + meths.nvim_input_mouse('right', 'press', 'A', 0, 6, 17) eq('0 1 r( a )', eval('g:testvar')) - meths.input_mouse('left', 'press', 'AS', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', 'AS', 0, 6, 17) eq('0 1 l(s a )', eval('g:testvar')) - meths.input_mouse('right', 'press', 'AS', 0, 6, 17) + meths.nvim_input_mouse('right', 'press', 'AS', 0, 6, 17) eq('0 1 r(s a )', eval('g:testvar')) - meths.input_mouse('left', 'press', 'T', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', 'T', 0, 6, 17) eq('0 1 l( m)', eval('g:testvar')) - meths.input_mouse('right', 'press', 'T', 0, 6, 17) + meths.nvim_input_mouse('right', 'press', 'T', 0, 6, 17) eq('0 1 r( m)', eval('g:testvar')) - meths.input_mouse('left', 'press', 'TS', 0, 6, 17) + meths.nvim_input_mouse('left', 'press', 'TS', 0, 6, 17) eq('0 1 l(s m)', eval('g:testvar')) - meths.input_mouse('right', 'press', 'TS', 0, 6, 17) + meths.nvim_input_mouse('right', 'press', 'TS', 0, 6, 17) eq('0 1 r(s m)', eval('g:testvar')) - meths.input_mouse('left', 'press', 'C', 0, 6, 17) + meths.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.set_option_value( + meths.nvim_set_option_value( 'statusline', '%0@MyClickFunc@Clicky stuff%T %= %0@MyClickFunc@Clicky stuff%T', {} @@ -198,15 +214,15 @@ for _, model in ipairs(mousemodels) do } -- clickable area on the right - meths.input_mouse('left', 'press', '', 0, 6, 35) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 35) eq('0 1 l', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 35) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 35) eq('0 1 r', eval('g:testvar')) -- clickable area on the left - meths.input_mouse('left', 'press', '', 0, 6, 5) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 5) eq('0 1 l', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 5) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 5) eq('0 1 r', eval('g:testvar')) end) @@ -214,9 +230,9 @@ for _, model in ipairs(mousemodels) do command([[ let &stl = '%@Test@%T%@MyClickFunc@%=%T%@Test@' ]]) - meths.input_mouse('left', 'press', '', 0, 6, 0) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 0) eq('0 1 l', eval('g:testvar')) - meths.input_mouse('right', 'press', '', 0, 6, 39) + meths.nvim_input_mouse('right', 'press', '', 0, 6, 39) eq('0 1 r', eval('g:testvar')) end) @@ -224,7 +240,7 @@ for _, model in ipairs(mousemodels) do command([[ let &stl = '%@MyClickFunc@foo%X' .. repeat('a', 40) .. '%<t%@Test@bar%X%@Test@baz' ]]) - meths.input_mouse('left', 'press', '', 0, 6, 2) + meths.nvim_input_mouse('left', 'press', '', 0, 6, 2) eq('0 1 l', eval('g:testvar')) end) end) @@ -366,38 +382,38 @@ describe('global statusline', function() end) it('win_move_statusline() can reduce cmdheight to 1', function() - eq(1, meths.get_option_value('cmdheight', {})) + eq(1, meths.nvim_get_option_value('cmdheight', {})) funcs.win_move_statusline(0, -1) - eq(2, meths.get_option_value('cmdheight', {})) + eq(2, meths.nvim_get_option_value('cmdheight', {})) funcs.win_move_statusline(0, -1) - eq(3, meths.get_option_value('cmdheight', {})) + eq(3, meths.nvim_get_option_value('cmdheight', {})) funcs.win_move_statusline(0, 1) - eq(2, meths.get_option_value('cmdheight', {})) + eq(2, meths.nvim_get_option_value('cmdheight', {})) funcs.win_move_statusline(0, 1) - eq(1, meths.get_option_value('cmdheight', {})) + eq(1, meths.nvim_get_option_value('cmdheight', {})) end) it('mouse dragging can reduce cmdheight to 1', function() command('set mouse=a') - meths.input_mouse('left', 'press', '', 0, 14, 10) - eq(1, meths.get_option_value('cmdheight', {})) - meths.input_mouse('left', 'drag', '', 0, 13, 10) - eq(2, meths.get_option_value('cmdheight', {})) - meths.input_mouse('left', 'drag', '', 0, 12, 10) - eq(3, meths.get_option_value('cmdheight', {})) - meths.input_mouse('left', 'drag', '', 0, 13, 10) - eq(2, meths.get_option_value('cmdheight', {})) - meths.input_mouse('left', 'drag', '', 0, 14, 10) - eq(1, meths.get_option_value('cmdheight', {})) - meths.input_mouse('left', 'drag', '', 0, 15, 10) - eq(1, meths.get_option_value('cmdheight', {})) - meths.input_mouse('left', 'drag', '', 0, 14, 10) - eq(1, meths.get_option_value('cmdheight', {})) + 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', {})) end) it('cmdline row is correct after setting cmdheight #20514', function() command('botright split test/functional/fixtures/bigfile.txt') - meths.set_option_value('cmdheight', 1, {}) + meths.nvim_set_option_value('cmdheight', 1, {}) feed('L') screen:expect([[ | @@ -428,7 +444,7 @@ describe('global statusline', function() {2:test/functional/fixtures/bigfile.txt 8,1 0%}| | ]]) - meths.set_option_value('showtabline', 2, {}) + meths.nvim_set_option_value('showtabline', 2, {}) screen:expect([[ {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| | @@ -443,7 +459,7 @@ describe('global statusline', function() {2:test/functional/fixtures/bigfile.txt 8,1 0%}| | ]]) - meths.set_option_value('cmdheight', 0, {}) + meths.nvim_set_option_value('cmdheight', 0, {}) screen:expect([[ {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| | @@ -458,7 +474,7 @@ describe('global statusline', function() ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | {2:test/functional/fixtures/bigfile.txt 8,1 0%}| ]]) - meths.set_option_value('cmdheight', 1, {}) + meths.nvim_set_option_value('cmdheight', 1, {}) screen:expect([[ {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| | @@ -478,8 +494,8 @@ end) it('statusline does not crash if it has Arabic characters #19447', function() clear() - meths.set_option_value('statusline', 'غً', {}) - meths.set_option_value('laststatus', 2, {}) + meths.nvim_set_option_value('statusline', 'غً', {}) + meths.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 f270d298cb..9a75e6333b 100644 --- a/test/functional/ui/tabline_spec.lua +++ b/test/functional/ui/tabline_spec.lua @@ -138,7 +138,7 @@ describe('tabline', function() command('tabnew') insert('tab2') command('tabprev') - meths.set_option_value('tabline', '%1T口口%2Ta' .. ('b'):rep(38) .. '%999Xc', {}) + meths.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.input_mouse('left', 'press', '', 0, 0, 1) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 1) screen:expect { grid = [[ {1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| @@ -157,7 +157,7 @@ describe('tabline', function() | ]], } - meths.input_mouse('left', 'press', '', 0, 0, 0) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 0) screen:expect { grid = [[ {1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| @@ -166,7 +166,7 @@ describe('tabline', function() | ]], } - meths.input_mouse('left', 'press', '', 0, 0, 39) + meths.nvim_input_mouse('left', 'press', '', 0, 0, 39) screen:expect { grid = [[ {1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| @@ -175,7 +175,7 @@ describe('tabline', function() | ]], } - meths.input_mouse('left', 'press', '', 0, 0, 40) + meths.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 6f86b61431..222850ee42 100644 --- a/test/functional/ui/title_spec.lua +++ b/test/functional/ui/title_spec.lua @@ -58,7 +58,7 @@ describe('title', function() end) it('an RPC call to nvim_set_option_value in a hidden buffer', function() - meths.set_option_value('autoindent', true, { buf = buf2 }) + meths.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.win_set_buf(oldwin, buf2) + meths.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.open_win(buf2, false, { + meths.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 749ddf72f8..45eb9222c2 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -413,12 +413,12 @@ describe("'wildmenu'", function() } -- Wildcharm? where we are going we aint't no need no wildcharm. - eq(0, meths.get_option_value('wildcharm', {})) + eq(0, meths.nvim_get_option_value('wildcharm', {})) -- Don't mess the defaults yet (neovim is about backwards compatibility) - eq(9, meths.get_option_value('wildchar', {})) + eq(9, meths.nvim_get_option_value('wildchar', {})) -- Lol what is cnoremap? Some say it can define mappings. command 'set wildchar=0' - eq(0, meths.get_option_value('wildchar', {})) + eq(0, meths.nvim_get_option_value('wildchar', {})) command 'cnoremap <f2> <c-z>' feed(':syntax <f2>') @@ -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.set_option_value('wildmenu', true, {}) - meths.set_option_value('wildmode', 'full', {}) - meths.set_option_value('wildoptions', 'pum', {}) + meths.nvim_set_option_value('wildmenu', true, {}) + meths.nvim_set_option_value('wildmode', 'full', {}) + meths.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.set_option_value('wildmenu', false, {}) - meths.set_option_value('wildmode', 'full', {}) + meths.nvim_set_option_value('wildmenu', false, {}) + meths.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.set_option_value('wildmenu', false, {}) - meths.set_option_value('wildmode', 'list', {}) + meths.nvim_set_option_value('wildmenu', false, {}) + meths.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 502c61a31b..6a09d3a555 100644 --- a/test/functional/ui/winbar_spec.lua +++ b/test/functional/ui/winbar_spec.lua @@ -40,7 +40,7 @@ describe('winbar', function() foreground = Screen.colors.Magenta, }, }) - meths.set_option_value('winbar', 'Set Up The Bars', {}) + meths.nvim_set_option_value('winbar', 'Set Up The Bars', {}) end) it('works', function() @@ -185,7 +185,7 @@ describe('winbar', function() insert [[ just some random text]] - meths.set_option_value('winbar', 'Hello, I am a ruler: %l,%c', {}) + meths.nvim_set_option_value('winbar', 'Hello, I am a ruler: %l,%c', {}) screen:expect { grid = [[ {1:Hello, I am a ruler: 2,11 }| @@ -265,7 +265,7 @@ describe('winbar', function() line sin(theta) line 8]]) - meths.input_mouse('left', 'press', '', 0, 5, 1) + meths.nvim_input_mouse('left', 'press', '', 0, 5, 1) screen:expect([[ {1:Set Up The Bars }| line 1 | @@ -279,9 +279,9 @@ describe('winbar', function() {3:~ }|*3 | ]]) - eq({ 5, 1 }, meths.win_get_cursor(0)) + eq({ 5, 1 }, meths.nvim_win_get_cursor(0)) - meths.input_mouse('left', 'drag', '', 0, 6, 2) + meths.nvim_input_mouse('left', 'drag', '', 0, 6, 2) screen:expect([[ {1:Set Up The Bars }| line 1 | @@ -295,9 +295,9 @@ describe('winbar', function() {3:~ }|*3 {1:-- VISUAL --} | ]]) - eq({ 6, 2 }, meths.win_get_cursor(0)) + eq({ 6, 2 }, meths.nvim_win_get_cursor(0)) - meths.input_mouse('left', 'drag', '', 0, 1, 2) + meths.nvim_input_mouse('left', 'drag', '', 0, 1, 2) screen:expect([[ {1:Set Up The Bars }| li^n{7:e 1} | @@ -311,11 +311,11 @@ describe('winbar', function() {3:~ }|*3 {1:-- VISUAL --} | ]]) - eq({ 1, 2 }, meths.win_get_cursor(0)) + eq({ 1, 2 }, meths.nvim_win_get_cursor(0)) - meths.input_mouse('left', 'drag', '', 0, 0, 2) + meths.nvim_input_mouse('left', 'drag', '', 0, 0, 2) screen:expect_unchanged() - eq({ 1, 2 }, meths.win_get_cursor(0)) + eq({ 1, 2 }, meths.nvim_win_get_cursor(0)) end) it('dragging statusline with mouse works correctly', function() @@ -332,9 +332,9 @@ describe('winbar', function() | ]]) - meths.input_mouse('left', 'press', '', 1, 5, 10) + meths.nvim_input_mouse('left', 'press', '', 1, 5, 10) poke_eventloop() - meths.input_mouse('left', 'drag', '', 1, 6, 10) + meths.nvim_input_mouse('left', 'drag', '', 1, 6, 10) screen:expect([[ {1:Set Up The Bars }| ^ | @@ -347,7 +347,7 @@ describe('winbar', function() | ]]) - meths.input_mouse('left', 'drag', '', 1, 4, 10) + meths.nvim_input_mouse('left', 'drag', '', 1, 4, 10) screen:expect([[ {1:Set Up The Bars }| ^ | @@ -360,9 +360,9 @@ describe('winbar', function() | ]]) - meths.input_mouse('left', 'press', '', 1, 11, 10) + meths.nvim_input_mouse('left', 'press', '', 1, 11, 10) poke_eventloop() - meths.input_mouse('left', 'drag', '', 1, 9, 10) + meths.nvim_input_mouse('left', 'drag', '', 1, 9, 10) screen:expect([[ {1:Set Up The Bars }| ^ | @@ -374,9 +374,9 @@ describe('winbar', function() {2:[No Name] }| |*3 ]]) - eq(3, meths.get_option_value('cmdheight', {})) + eq(3, meths.nvim_get_option_value('cmdheight', {})) - meths.input_mouse('left', 'drag', '', 1, 11, 10) + meths.nvim_input_mouse('left', 'drag', '', 1, 11, 10) screen:expect([[ {1:Set Up The Bars }| ^ | @@ -388,7 +388,7 @@ describe('winbar', function() {2:[No Name] }| | ]]) - eq(1, meths.get_option_value('cmdheight', {})) + eq(1, meths.nvim_get_option_value('cmdheight', {})) end) it('properly equalizes window height for window-local value', function() @@ -413,9 +413,12 @@ describe('winbar', function() end) it('requires window-local value for floating windows', function() - local win = - meths.open_win(0, false, { relative = 'editor', row = 2, col = 10, height = 7, width = 30 }) - meths.set_option_value('winbar', 'bar', {}) + local win = meths.nvim_open_win( + 0, + false, + { relative = 'editor', row = 2, col = 10, height = 7, width = 30 } + ) + meths.nvim_set_option_value('winbar', 'bar', {}) screen:expect { grid = [[ {1:bar }| @@ -426,7 +429,7 @@ describe('winbar', function() | ]], } - meths.set_option_value('winbar', 'floaty bar', { scope = 'local', win = win.id }) + meths.nvim_set_option_value('winbar', 'floaty bar', { scope = 'local', win = win.id }) screen:expect { grid = [[ {1:bar }| @@ -529,7 +532,7 @@ describe('local winbar with tabs', function() [3] = { bold = true, foreground = Screen.colors.Blue }, [4] = { underline = true, background = Screen.colors.LightGray }, }) - meths.set_option_value('winbar', 'foo', { scope = 'local', win = 0 }) + meths.nvim_set_option_value('winbar', 'foo', { scope = 'local', win = 0 }) end) it('works', function() |