diff options
author | luukvbaal <luukvbaal@gmail.com> | 2025-03-19 11:00:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-19 10:00:42 +0000 |
commit | d6653e1cc957ef39b397e073230da87ee9a5411d (patch) | |
tree | 7582389a62aaf0383fcf50e2ff9026398703e59a /test | |
parent | 5ff8a2fa8bd1644813c16d797d9101fece714365 (diff) | |
download | rneovim-d6653e1cc957ef39b397e073230da87ee9a5411d.tar.gz rneovim-d6653e1cc957ef39b397e073230da87ee9a5411d.tar.bz2 rneovim-d6653e1cc957ef39b397e073230da87ee9a5411d.zip |
fix(marks): ensure decor is removed with proper range (#32973)
Problem: Paired mark whose end is in front of its start should not have
its decor removed (as fixed by 72f630f9), but may still need to
have its range redrawn.
Solution: Still call `buf_decor_remove()` but ensure it is not called with
an inverse range when `extmark_del()` is called on an end mark.
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() |