diff options
Diffstat (limited to 'test/functional/ui')
-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 |
5 files changed, 112 insertions, 15 deletions
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| |