diff options
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/editor/completion_spec.lua | 68 | ||||
-rw-r--r-- | test/functional/editor/runtime_spec.lua (renamed from test/functional/lua/runtime_spec.lua) | 18 | ||||
-rw-r--r-- | test/functional/fixtures/lua/test_plug/lua/health.lua | 8 | ||||
-rw-r--r-- | test/functional/legacy/matchparen_spec.lua | 22 | ||||
-rw-r--r-- | test/functional/legacy/messages_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/plugin/health_spec.lua | 12 | ||||
-rw-r--r-- | test/functional/plugin/lsp/completion_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/plugin/lsp/folding_range_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/testnvim.lua | 2 | ||||
-rw-r--r-- | test/functional/ui/cmdline_highlight_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 53 | ||||
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 24 | ||||
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 22 | ||||
-rw-r--r-- | test/functional/ui/statuscolumn_spec.lua | 24 |
14 files changed, 197 insertions, 68 deletions
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua index 39072ede9c..106e0df347 100644 --- a/test/functional/editor/completion_spec.lua +++ b/test/functional/editor/completion_spec.lua @@ -4,8 +4,8 @@ local Screen = require('test.functional.ui.screen') local assert_alive = n.assert_alive local clear, feed = n.clear, n.feed -local eval, eq, neq, ok = n.eval, t.eq, t.neq, t.ok -local feed_command, source, expect = n.feed_command, n.source, n.expect +local eval, eq, ok = n.eval, t.eq, t.ok +local source, expect = n.source, n.expect local fn = n.fn local command = n.command local api = n.api @@ -17,6 +17,11 @@ describe('completion', function() before_each(function() clear() + source([[ + set completeopt-=noselect + " Avoid tags completion (if running test locally). + set complete-=t + ]]) screen = Screen.new(60, 8) screen:add_extra_attr_ids { [100] = { foreground = Screen.colors.Gray0, background = Screen.colors.Yellow }, @@ -57,29 +62,12 @@ describe('completion', function() it('is readonly', function() screen:try_resize(80, 8) feed('ifoo<ESC>o<C-x><C-n><ESC>') - feed_command('let v:completed_item.word = "bar"') - neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - feed_command('let v:errmsg = ""') - - feed_command('let v:completed_item.abbr = "bar"') - neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - feed_command('let v:errmsg = ""') - - feed_command('let v:completed_item.menu = "bar"') - neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - feed_command('let v:errmsg = ""') - - feed_command('let v:completed_item.info = "bar"') - neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - feed_command('let v:errmsg = ""') - - feed_command('let v:completed_item.kind = "bar"') - neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - feed_command('let v:errmsg = ""') - - feed_command('let v:completed_item.user_data = "bar"') - neq(nil, string.find(eval('v:errmsg'), '^E46: ')) - feed_command('let v:errmsg = ""') + t.matches('E46%: ', t.pcall_err(command, 'let v:completed_item.word = "bar"')) + t.matches('E46%: ', t.pcall_err(command, 'let v:completed_item.abbr = "bar"')) + t.matches('E46%: ', t.pcall_err(command, 'let v:completed_item.menu = "bar"')) + t.matches('E46%: ', t.pcall_err(command, 'let v:completed_item.info = "bar"')) + t.matches('E46%: ', t.pcall_err(command, 'let v:completed_item.kind = "bar"')) + t.matches('E46%: ', t.pcall_err(command, 'let v:completed_item.user_data = "bar"')) end) it('returns expected dict in omni completion', function() source([[ @@ -122,7 +110,7 @@ describe('completion', function() end) it('inserts the first candidate if default', function() - feed_command('set completeopt+=menuone') + command('set completeopt+=menuone') feed('ifoo<ESC>o') screen:expect([[ foo | @@ -160,7 +148,7 @@ describe('completion', function() eq('foo', eval('getline(3)')) end) it('selects the first candidate if noinsert', function() - feed_command('set completeopt+=menuone,noinsert') + command('set completeopt+=menuone,noinsert') feed('ifoo<ESC>o<C-x><C-n>') screen:expect([[ foo | @@ -190,7 +178,7 @@ describe('completion', function() eq('foo', eval('getline(3)')) end) it('does not insert the first candidate if noselect', function() - feed_command('set completeopt+=menuone,noselect') + command('set completeopt+=menuone,noselect') feed('ifoo<ESC>o<C-x><C-n>') screen:expect([[ foo | @@ -221,7 +209,7 @@ describe('completion', function() eq('bar', eval('getline(3)')) end) it('does not select/insert the first candidate if noselect and noinsert', function() - feed_command('set completeopt+=menuone,noselect,noinsert') + command('set completeopt+=menuone,noselect,noinsert') feed('ifoo<ESC>o<C-x><C-n>') screen:expect([[ foo | @@ -258,14 +246,14 @@ describe('completion', function() eq('', eval('getline(3)')) end) it('does not change modified state if noinsert', function() - feed_command('set completeopt+=menuone,noinsert') - feed_command('setlocal nomodified') + command('set completeopt+=menuone,noinsert') + command('setlocal nomodified') feed('i<C-r>=TestComplete()<CR><ESC>') eq(0, eval('&l:modified')) end) it('does not change modified state if noselect', function() - feed_command('set completeopt+=menuone,noselect') - feed_command('setlocal nomodified') + command('set completeopt+=menuone,noselect') + command('setlocal nomodified') feed('i<C-r>=TestComplete()<CR><ESC>') eq(0, eval('&l:modified')) end) @@ -279,8 +267,8 @@ describe('completion', function() return '' endfunction ]]) - feed_command('set completeopt+=noselect,noinsert') - feed_command('inoremap <right> <c-r>=TestComplete()<cr>') + command('set completeopt+=noselect,noinsert') + command('inoremap <right> <c-r>=TestComplete()<cr>') end) local tests = { @@ -534,7 +522,7 @@ describe('completion', function() return '' endfunction ]]) - feed_command('set completeopt=menuone,noselect') + command('set completeopt=menuone,noselect') end) it('works', function() @@ -792,7 +780,7 @@ describe('completion', function() end) it('disables folding during completion', function() - feed_command('set foldmethod=indent') + command('set foldmethod=indent') feed('i<Tab>foo<CR><Tab>bar<Esc>gg') screen:expect([[ ^foo | @@ -811,7 +799,7 @@ describe('completion', function() end) it('popupmenu is not interrupted by events', function() - feed_command('set complete=.') + command('set complete=.') feed('ifoobar fooegg<cr>f<c-p>') screen:expect([[ @@ -1027,8 +1015,8 @@ describe('completion', function() end) it("'ignorecase' 'infercase' CTRL-X CTRL-N #6451", function() - feed_command('set ignorecase infercase') - feed_command('edit runtime/doc/credits.txt') + command('set ignorecase infercase') + command('edit runtime/doc/credits.txt') feed('oX<C-X><C-N>') screen:expect { grid = [[ diff --git a/test/functional/lua/runtime_spec.lua b/test/functional/editor/runtime_spec.lua index b903db14b4..ce46d25a54 100644 --- a/test/functional/lua/runtime_spec.lua +++ b/test/functional/editor/runtime_spec.lua @@ -51,7 +51,7 @@ describe('runtime:', function() mkdir_p(colorscheme_folder) end) - it('lua colorschemes work and are included in cmdline completion', function() + it('Lua colorschemes work and are included in cmdline completion', function() local colorscheme_file = table.concat({ colorscheme_folder, 'new_colorscheme.lua' }, sep) write_file(colorscheme_file, [[vim.g.lua_colorscheme = 1]]) @@ -129,7 +129,7 @@ describe('runtime:', function() mkdir_p(compiler_folder) end) - it('lua compilers work and are included in cmdline completion', function() + it('Lua compilers work and are included in cmdline completion', function() local compiler_file = compiler_folder .. sep .. 'new_compiler.lua' write_file(compiler_file, [[vim.b.lua_compiler = 1]]) @@ -170,7 +170,7 @@ describe('runtime:', function() describe('ftplugin', function() local ftplugin_folder = table.concat({ plug_dir, 'ftplugin' }, sep) - it('lua ftplugins work and are included in cmdline completion', function() + it('Lua ftplugins work and are included in cmdline completion', function() mkdir_p(ftplugin_folder) local ftplugin_file = table.concat({ ftplugin_folder, 'new-ft.lua' }, sep) write_file(ftplugin_file, [[vim.b.lua_ftplugin = 1]]) @@ -283,7 +283,7 @@ describe('runtime:', function() describe('indent', function() local indent_folder = table.concat({ plug_dir, 'indent' }, sep) - it('lua indents work and are included in cmdline completion', function() + it('Lua indents work and are included in cmdline completion', function() mkdir_p(indent_folder) local indent_file = table.concat({ indent_folder, 'new-ft.lua' }, sep) write_file(indent_file, [[vim.b.lua_indent = 1]]) @@ -328,23 +328,23 @@ describe('runtime:', function() exec([[let b:current_syntax = '']]) end) - it('loads lua syntaxes on filetype change', function() + it('loads Lua syntaxes on filetype change', function() exec('set filetype=my-lang') eq('my-lang', eval('b:current_syntax')) end) - it('loads lua syntaxes on syntax change', function() + it('loads Lua syntaxes on syntax change', function() exec('set syntax=my-lang') eq('my-lang', eval('b:current_syntax')) end) - it('loads lua syntaxes for :ownsyntax', function() + it('loads Lua syntaxes for :ownsyntax', function() exec('ownsyntax my-lang') eq('my-lang', eval('w:current_syntax')) eq('', eval('b:current_syntax')) end) - it('lua syntaxes are included in cmdline completion', function() + it('Lua syntaxes are included in cmdline completion', function() eq({ 'my-lang' }, fn.getcompletion('my-l', 'filetype')) eq({ 'my-lang' }, fn.getcompletion('my-l', 'syntax')) eq({ 'syntax/my-lang.lua' }, fn.getcompletion('syntax/my-l', 'runtime')) @@ -408,7 +408,7 @@ describe('runtime:', function() end) end) - it('lua file loaded by :runtime has proper script ID #32598', function() + it('Lua file loaded by :runtime has proper script ID #32598', function() local test_file = 'Xtest_runtime_cmd.lua' write_file( table.concat({ plug_dir, test_file }, sep), diff --git a/test/functional/fixtures/lua/test_plug/lua/health.lua b/test/functional/fixtures/lua/test_plug/lua/health.lua new file mode 100644 index 0000000000..75164f37ab --- /dev/null +++ b/test/functional/fixtures/lua/test_plug/lua/health.lua @@ -0,0 +1,8 @@ +local M = {} + +M.check = function() + vim.health.start('nested lua/ directory') + vim.health.ok('everything is ok') +end + +return M diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua index 367830b564..665393463d 100644 --- a/test/functional/legacy/matchparen_spec.lua +++ b/test/functional/legacy/matchparen_spec.lua @@ -4,6 +4,7 @@ local Screen = require('test.functional.ui.screen') local clear = n.clear local exec = n.exec local feed = n.feed +local poke_eventloop = n.poke_eventloop describe('matchparen', function() before_each(clear) @@ -238,5 +239,26 @@ describe('matchparen', function() {1:~ }|*2 | ]]) + -- Send keys one by one so that CursorMoved is triggered. + for _, c in ipairs({ 'A', ' ', 'f', 'o', 'o', 'b', 'a', 'r' }) do + feed(c) + poke_eventloop() + end + screen:expect([[ + {18:#!/bin/sh} | + {25:SUSUWU_PRINT() (} | + {15:case} {15:"}{100:${LEVEL}}{15:"} {15:in} | + {15:"}{100:$SUSUWU_SH_NOTICE}{15:")} foobar^ | + {100:${SUSUWU_S}} {15:&&} {15:return} {26:1} | + {15:;;} | + {15:"}{100:$SUSUWU_SH_DEBUG}{15:")} | + {100:(}{15:!} {100:${SUSUWU_VERBOSE})} {15:&&} {15:return} {26:1} | + {15:;;} | + {15:esac} | + {18:# snip} | + {25:)} | + {1:~ }|*2 + {5:-- INSERT --} | + ]]) end) end) diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index e73a0780aa..8eb2436cbe 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -88,7 +88,7 @@ describe('messages', function() end) -- oldtest: Test_mode_cleared_after_silent_message() - it('mode is cleared properly after slient message', function() + it('mode is cleared properly after silent message', function() screen = Screen.new(60, 10) exec([[ edit XsilentMessageMode.txt diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 406b5c3c16..1f754b9685 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -212,6 +212,18 @@ describe('vim.health', function() n.expect([[ ERROR: No healthchecks found.]]) end) + + it('nested lua/ directory', function() + command('checkhealth lua') + n.expect([[ + + ============================================================================== + test_plug.lua: require("test_plug.lua.health").check() + + nested lua/ directory ~ + - OK everything is ok + ]]) + end) end) end) diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua index 94578aa6da..7772a47589 100644 --- a/test/functional/plugin/lsp/completion_spec.lua +++ b/test/functional/plugin/lsp/completion_spec.lua @@ -847,7 +847,7 @@ describe('vim.lsp.completion: protocol', function() exec_lua(function() local win = vim.api.nvim_get_current_win() vim.api.nvim_win_set_cursor(win, pos) - vim.lsp.completion.trigger() + vim.lsp.completion.get() end) retry(nil, nil, function() @@ -1153,7 +1153,7 @@ describe('vim.lsp.completion: protocol', function() end, }) - vim.lsp.completion.trigger() + vim.lsp.completion.get() return params end) diff --git a/test/functional/plugin/lsp/folding_range_spec.lua b/test/functional/plugin/lsp/folding_range_spec.lua index 7e68a598d2..601f00ef8a 100644 --- a/test/functional/plugin/lsp/folding_range_spec.lua +++ b/test/functional/plugin/lsp/folding_range_spec.lua @@ -612,7 +612,7 @@ static int foldLevel(linenr_T lnum) }) end) - it('is defered when the buffer is not up-to-date', function() + it('is deferred when the buffer is not up-to-date', function() exec_lua(function() vim.lsp.foldclose('comment') vim.lsp.util.buf_versions[bufnr] = 0 diff --git a/test/functional/testnvim.lua b/test/functional/testnvim.lua index ff5f9ff2e8..0a12cf0920 100644 --- a/test/functional/testnvim.lua +++ b/test/functional/testnvim.lua @@ -620,6 +620,8 @@ function M.insert(...) nvim_feed('<ESC>') end +--- @deprecated Use `command()` or `feed()` instead. +--- --- Executes an ex-command by user input. Because nvim_input() is used, Vimscript --- errors will not manifest as client (lua) errors. Use command() for that. --- @param ... string diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua index 0ee994ba0a..6e2f1f244f 100644 --- a/test/functional/ui/cmdline_highlight_spec.lua +++ b/test/functional/ui/cmdline_highlight_spec.lua @@ -477,7 +477,7 @@ describe('Command-line coloring', function() :++^ | ]]) end) - it('does not error out when called from a errorred out cycle', function() + it('does not error out when called from a errored out cycle', function() set_color_cb('ReturningGlobal', { { 0, 1, 'Normal' } }) feed(dedent([[ :set regexpengine=2 @@ -628,7 +628,7 @@ describe('Ex commands coloring', function() local msg = 'E5405: Chunk 0 start 10 splits multibyte character' eq('\n' .. msg, fn.execute('messages')) end) - it('does not error out when called from a errorred out cycle', function() + it('does not error out when called from a errored out cycle', function() -- Apparently when there is a cycle in which one of the commands errors out -- this error may be caught by color_cmdline before it is presented to the -- user. diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index ce7c9596bb..cb9d978a0f 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -865,6 +865,59 @@ local function test_cmdline(linegrid) }, }) end) + + it('works with conditionals', function() + local s1 = [[ + ^ | + {1:~ }|*3 + | + ]] + screen:expect(s1) + feed(':if 1<CR>') + screen:expect({ + grid = s1, + cmdline = { + { + content = { { '' } }, + firstc = ':', + indent = 2, + pos = 0, + }, + }, + cmdline_block = { { { 'if 1' } } }, + }) + feed(':let x = 1<CR>') + screen:expect({ + grid = s1, + cmdline = { + { + content = { { '' } }, + firstc = ':', + indent = 2, + pos = 0, + }, + }, + cmdline_block = { { { 'if 1' } }, { { ' :let x = 1' } } }, + }) + feed(':endif') + screen:expect({ + grid = s1, + cmdline = { + { + content = { { ':endif' } }, + firstc = ':', + indent = 2, + pos = 6, + }, + }, + cmdline_block = { { { 'if 1' } }, { { ' :let x = 1' } } }, + }) + feed('<CR>') + screen:expect({ + grid = s1, + cmdline = { { abort = false } }, + }) + end) end -- the representation of cmdline and cmdline_block contents changed with ext_linegrid diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index c0c0bf4fc1..240a5acc99 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -6366,6 +6366,30 @@ l5 ]] }) end) + + it('signcolumn correctly tracked with signs beyond eob and pair end before start', function() + api.nvim_set_option_value('signcolumn', 'auto:2', {}) + api.nvim_set_option_value('filetype', 'lua', {}) + api.nvim_buf_set_lines(0, 0, -1, false, {'foo', 'bar'}) + api.nvim_buf_set_extmark(0, ns, 2, 0, {sign_text='S1'}) + api.nvim_set_hl(0, 'SignColumn', { link = 'Error' }) + screen:expect([[ + ^foo | + bar | + {1:~ }|*7 + | + ]]) + api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text='S2', end_row = 1}) + api.nvim_buf_set_lines(0, 0, -1, false, {'-- foo', '-- bar'}) + api.nvim_buf_clear_namespace(0, ns, 0, -1) + screen:expect([[ + ^-- foo | + -- bar | + {1:~ }|*7 + | + ]]) + assert_alive() + end) end) describe('decorations: virt_text', function() diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index b351afbae4..728f8ed3d0 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -1311,7 +1311,7 @@ describe('builtin popupmenu', function() end end) - it('with preview-window above and tall and inverted', function() + it('with preview-window above, tall and inverted', function() feed(':ped<CR><c-w>8+') feed('iaa<cr>bb<cr>cc<cr>dd<cr>ee<cr>') feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>') @@ -1392,7 +1392,7 @@ describe('builtin popupmenu', function() end end) - it('with preview-window above and short and inverted', function() + it('with preview-window above, short and inverted', function() feed(':ped<CR><c-w>4+') feed('iaa<cr>bb<cr>cc<cr>dd<cr>ee<cr>') feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>') @@ -1468,7 +1468,7 @@ describe('builtin popupmenu', function() end end) - it('with preview-window below and inverted', function() + it('with preview-window below, inverted', function() feed(':ped<CR><c-w>4+<c-w>r') feed('iaa<cr>bb<cr>cc<cr>dd<cr>ee<cr>') feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>') @@ -1716,7 +1716,7 @@ describe('builtin popupmenu', function() return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}] endfunc set omnifunc=Omni_test - set completeopt+=longest + set completeopt-=popup completeopt+=longest,preview ]]) feed('Gi<C-X><C-O>') if multigrid then @@ -1850,7 +1850,7 @@ describe('builtin popupmenu', function() end end) - describe('floating window preview popup', function() + describe('completeopt=popup shows preview in floatwin', function() before_each(function() --row must > 10 screen:try_resize(40, 11) @@ -2264,7 +2264,7 @@ describe('builtin popupmenu', function() feed('<C-E><ESC>') end) - it('popup preview place in left', function() + it('popup preview placed to left', function() insert(('test'):rep(5)) feed('i<C-x><C-o>') if multigrid then @@ -7258,6 +7258,7 @@ describe('builtin popupmenu', function() endif return [#{word: "foo", info: "info"}, #{word: "bar"}, #{word: "你好"}] endfunc + set completeopt-=popup completeopt+=preview set omnifunc=Omni_test hi ComplMatchIns guifg=red ]]) @@ -7374,6 +7375,9 @@ describe('builtin popupmenu', function() endif return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}] endfunc + set completeopt-=popup completeopt+=preview + " Avoid unwanted results in case local workspace has a "tags" file. + set complete-=t set omnifunc=Omni_test hi Normal guibg=blue hi CursorLine guibg=green guifg=white @@ -7437,7 +7441,7 @@ describe('builtin popupmenu', function() feed('<Esc>') -- Does not highlight the compl leader - command('set cot+=menuone,noselect') + command('set completeopt+=menuone,noselect') feed('S<C-X><C-O>') local pum_start = [[ {10:^ }| @@ -7457,7 +7461,7 @@ describe('builtin popupmenu', function() ]]) feed('<C-E><ESC>') - command('set cot+=fuzzy') + command('set completeopt+=fuzzy') feed('S<C-X><C-O>') screen:expect(pum_start) feed('f<C-N>') @@ -7469,7 +7473,7 @@ describe('builtin popupmenu', function() ]]) feed('<C-E><Esc>') - command('set cot-=fuzzy') + command('set completeopt-=fuzzy') feed('Sf<C-N>') screen:expect([[ {10:f^ }| diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index 6c415b3dfa..2004606b63 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -500,7 +500,7 @@ describe('statuscolumn', function() {8:buffer 0 5}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {8:wrapped 1 5}aaaaaaaa | {8:virtual-2 5}virt_line | - {8:virtual-1 5}virt_line above | + {8:virtual-1 6}virt_line above | {8:buffer 0 6}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {8:wrapped 1 6}aaaaaaaa | {8:buffer 0 7}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| @@ -510,10 +510,26 @@ describe('statuscolumn', function() {8:wrapped 1 9}aaaaaaaa | | ]]) - -- Also test virt_lines at the end of buffer - exec_lua([[ - vim.api.nvim_buf_set_extmark(0, ns, 15, 0, { virt_lines = {{{"END", ""}}} }) + -- Also correct v:lnum with a partial redraw + exec_lua('vim.api.nvim_buf_set_extmark(0, ns, 4, 0, { virt_lines = {{{"virt_line", ""}}} })') + screen:expect([[ + {8:buffer 0 4}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {8:wrapped 1 4}aaaaaaaa | + {8:buffer 0 5}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {8:wrapped 1 5}aaaaaaaa | + {8:virtual-3 5}virt_line | + {8:virtual-2 5}virt_line | + {8:virtual-1 6}virt_line above | + {8:buffer 0 6}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {8:wrapped 1 6}aaaaaaaa | + {8:buffer 0 7}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {8:wrapped 1 7}aaaaaaaa | + {15:buffer 0 8}{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| + {8:buffer 0 9}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:@@@}| + | ]]) + -- Also test virt_lines at the end of buffer + exec_lua('vim.api.nvim_buf_set_extmark(0, ns, 15, 0, { virt_lines = {{{"END", ""}}} })') feed('GkJzz') screen:expect([[ {8:buffer 0 12}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| |