diff options
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/api/extmark_spec.lua | 56 | ||||
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 135 |
2 files changed, 178 insertions, 13 deletions
diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua index 8a4aea1efe..fd392d479d 100644 --- a/test/functional/api/extmark_spec.lua +++ b/test/functional/api/extmark_spec.lua @@ -124,6 +124,10 @@ describe('API/extmarks', function() ) eq("Invalid 'hl_mode': 'foo'", pcall_err(set_extmark, ns, marks[2], 0, 0, { hl_mode = 'foo' })) eq( + "Invalid 'virt_lines_overflow': 'foo'", + pcall_err(set_extmark, ns, marks[2], 0, 0, { virt_lines_overflow = 'foo' }) + ) + eq( "Invalid 'id': expected Integer, got Array", pcall_err(set_extmark, ns, {}, 0, 0, { end_col = 1, end_row = 1 }) ) @@ -1576,11 +1580,6 @@ describe('API/extmarks', function() virt_text_hide = true, virt_text_pos = 'right_align', }) - set_extmark(ns, marks[2], 0, 0, { - priority = 0, - virt_text = { { '', 'Macro' }, { '', { 'Type', 'Search' } }, { '' } }, - virt_text_win_col = 1, - }) eq({ 0, 0, @@ -1607,12 +1606,20 @@ describe('API/extmarks', function() }, virt_lines_above = true, virt_lines_leftcol = true, + virt_lines_overflow = 'trunc', virt_text = { { 'text', 'Macro' }, { '???' }, { 'stack', { 'Type', 'Search' } } }, virt_text_repeat_linebreak = false, virt_text_hide = true, virt_text_pos = 'right_align', }, }, get_extmark_by_id(ns, marks[1], { details = true })) + + set_extmark(ns, marks[2], 0, 0, { + priority = 0, + virt_text = { { '', 'Macro' }, { '', { 'Type', 'Search' } }, { '' } }, + virt_text_repeat_linebreak = true, + virt_text_win_col = 1, + }) eq({ 0, 0, @@ -1621,13 +1628,35 @@ describe('API/extmarks', function() right_gravity = true, priority = 0, virt_text = { { '', 'Macro' }, { '', { 'Type', 'Search' } }, { '' } }, - virt_text_repeat_linebreak = false, + virt_text_repeat_linebreak = true, virt_text_hide = false, virt_text_pos = 'win_col', virt_text_win_col = 1, }, }, get_extmark_by_id(ns, marks[2], { details = true })) - set_extmark(ns, marks[3], 0, 0, { cursorline_hl_group = 'Statement' }) + + set_extmark(ns, marks[3], 0, 0, { + priority = 0, + ui_watched = true, + virt_lines = { { { '', 'Macro' }, { '' }, { '', '' } } }, + virt_lines_overflow = 'scroll', + }) + eq({ + 0, + 0, + { + ns_id = 1, + right_gravity = true, + ui_watched = true, + priority = 0, + virt_lines = { { { '', 'Macro' }, { '' }, { '', '' } } }, + virt_lines_above = false, + virt_lines_leftcol = false, + virt_lines_overflow = 'scroll', + }, + }, get_extmark_by_id(ns, marks[3], { details = true })) + + set_extmark(ns, marks[4], 0, 0, { cursorline_hl_group = 'Statement' }) eq({ 0, 0, @@ -1637,8 +1666,9 @@ describe('API/extmarks', function() priority = 4096, right_gravity = true, }, - }, get_extmark_by_id(ns, marks[3], { details = true })) - set_extmark(ns, marks[4], 0, 0, { + }, get_extmark_by_id(ns, marks[4], { details = true })) + + set_extmark(ns, marks[5], 0, 0, { end_col = 1, conceal = 'a', spell = true, @@ -1655,8 +1685,9 @@ describe('API/extmarks', function() right_gravity = true, spell = true, }, - }, get_extmark_by_id(ns, marks[4], { details = true })) - set_extmark(ns, marks[5], 0, 0, { + }, get_extmark_by_id(ns, marks[5], { details = true })) + + set_extmark(ns, marks[6], 0, 0, { end_col = 1, spell = false, }) @@ -1671,7 +1702,8 @@ describe('API/extmarks', function() right_gravity = true, spell = false, }, - }, get_extmark_by_id(ns, marks[5], { details = true })) + }, get_extmark_by_id(ns, marks[6], { details = true })) + api.nvim_buf_clear_namespace(0, ns, 0, -1) -- legacy sign mark includes sign name command('sign define sign1 text=s1 texthl=Title linehl=LineNR numhl=Normal culhl=CursorLine') diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 2f83e7b97a..0f0aa3a5ed 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -4949,7 +4949,6 @@ if (h->n_buckets < new_n_buckets) { // expand ]]} end) - it('works with hard TABs', function() insert(example_text2) feed 'gg' @@ -5020,6 +5019,140 @@ if (h->n_buckets < new_n_buckets) { // expand ]]} end) + it('scrolls horizontally with virt_lines_overflow = "scroll" #31000', function() + command('set nowrap signcolumn=yes') + insert('abcdefghijklmnopqrstuvwxyz') + api.nvim_buf_set_extmark(0, ns, 0, 0, { + virt_lines = { + { { '12αβ̳γ̲口=', 'Special' }, { '❤️345678', 'Special' } }, + { { '123\t45\t678', 'NonText' } }, + }, + virt_lines_overflow = 'scroll', + }) + screen:expect([[ + {7: }abcdefghijklmnopqrstuvwxy^z | + {7: }{16:12αβ̳γ̲口=❤️345678} | + {7: }{1:123 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }bcdefghijklmnopqrstuvwxy^z | + {7: }{16:2αβ̳γ̲口=❤️345678} | + {7: }{1:23 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }cdefghijklmnopqrstuvwxy^z | + {7: }{16:αβ̳γ̲口=❤️345678} | + {7: }{1:3 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }defghijklmnopqrstuvwxy^z | + {7: }{16:β̳γ̲口=❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }efghijklmnopqrstuvwxy^z | + {7: }{16:γ̲口=❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }fghijklmnopqrstuvwxy^z | + {7: }{16:口=❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }ghijklmnopqrstuvwxy^z | + {7: }{16: =❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }hijklmnopqrstuvwxy^z | + {7: }{16:=❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }ijklmnopqrstuvwxy^z | + {7: }{16:❤️345678} | + {7: }{1:45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }jklmnopqrstuvwxy^z | + {7: }{16: 345678} | + {7: }{1:5 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }klmnopqrstuvwxy^z | + {7: }{16:345678} | + {7: }{1: 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }lmnopqrstuvwxy^z | + {7: }{16:45678} | + {7: }{1: 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }mnopqrstuvwxy^z | + {7: }{16:5678} | + {7: }{1: 678} | + {1:~ }|*8 + | + ]]) + api.nvim_buf_set_extmark(0, ns, 0, 1, { + virt_lines = { { { '123\t45\t67', 'NonText' } } }, + virt_lines_leftcol = true, + virt_lines_overflow = 'trunc', + }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { + virt_lines = { { { '123\t45\t6', 'NonText' } } }, + virt_lines_leftcol = false, + virt_lines_overflow = 'trunc', + }) + screen:expect([[ + {7: }mnopqrstuvwxy^z | + {7: }{16:5678} | + {7: }{1: 678} | + {1:123 45 67} | + {7: }{1:123 45 6} | + {1:~ }|*6 + | + ]]) + end) + it('does not show twice if end_row or end_col is specified #18622', function() screen:try_resize(50, 8) insert([[ |