diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 240a5acc99..fe414783fd 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -6393,24 +6393,19 @@ l5 end) describe('decorations: virt_text', function() - local screen ---@type test.functional.ui.screen + local ns, screen ---@type integer, test.functional.ui.screen before_each(function() clear() screen = Screen.new(50, 10) + ns = api.nvim_create_namespace('test') end) it('avoids regression in #17638', function() - exec_lua[[ - vim.wo.number = true - vim.wo.relativenumber = true - ]] - + command 'set number relativenumber' command 'normal 4ohello' command 'normal aVIRTUAL' - local ns = api.nvim_create_namespace('test') - api.nvim_buf_set_extmark(0, ns, 2, 0, { virt_text = {{"hello", "String"}}, virt_text_win_col = 20, @@ -6451,7 +6446,6 @@ describe('decorations: virt_text', function() | ]]} - local ns = api.nvim_create_namespace('ns') for row = 1, 5 do api.nvim_buf_set_extmark(0, ns, row, 0, { id = 1, virt_text = {{'world', 'Normal'}} }) end @@ -6464,6 +6458,30 @@ describe('decorations: virt_text', function() | ]]} end) + + it('redraws correctly when removing mark whose end ends up in front of start', function() + command('normal 5ohello') + api.nvim_buf_set_extmark(0, ns, 2, 0, { end_col = 1, virt_text = {{'world', 'Normal'}} }) + screen:expect([[ + | + hello | + hello world | + hello |*2 + hell^o | + {1:~ }|*3 + | + ]]) + feed('3Gdd') + api.nvim_buf_clear_namespace(0, ns, 0, -1) + screen:expect([[ + | + hello | + ^hello | + hello |*2 + {1:~ }|*4 + | + ]]) + end) end) describe('decorations: window scoped', function() |