diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-02-23 11:38:27 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-02-23 11:41:09 +0100 |
commit | b97d5038f16b1be4e413c4215e90818c05fb7ea1 (patch) | |
tree | 3b0ac3511f1fd269a928fa8cfc51b841afe834ac | |
parent | e2e63bd045491f36e12c924fddbe76b3ef884b38 (diff) | |
download | rneovim-b97d5038f16b1be4e413c4215e90818c05fb7ea1.tar.gz rneovim-b97d5038f16b1be4e413c4215e90818c05fb7ea1.tar.bz2 rneovim-b97d5038f16b1be4e413c4215e90818c05fb7ea1.zip |
fix(marktree): some marks counted twice when checking for overlap
fixes #27046
-rw-r--r-- | src/nvim/marktree.c | 2 | ||||
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index dcb839d07f..0ebebf409e 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -1831,7 +1831,7 @@ bool marktree_itr_step_overlap(MarkTree *b, MarkTreeIter *itr, MTPair *pair) } unrelative(itr->pos, &k.pos); MTKey start = marktree_lookup(b, id, NULL); - if (pos_less(itr->intersect_pos, start.pos)) { + if (pos_leq(itr->intersect_pos, start.pos)) { continue; } *pair = mtpair_from(start, k); diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index b6e1a776e8..e57e719192 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -5387,6 +5387,30 @@ l5 | ]]} end) + + it('correct number of signs after deleting text (#27046)', function() + command('call setline(1, ["foo"]->repeat(31))') + api.nvim_buf_set_extmark(0, ns, 0, 0, {end_row = 0, sign_text = 'S1'}) + api.nvim_buf_set_extmark(0, ns, 0, 0, {end_row = 0, end_col = 3, hl_group = 'Error'}) + api.nvim_buf_set_extmark(0, ns, 9, 0, {end_row = 9, sign_text = 'S2'}) + api.nvim_buf_set_extmark(0, ns, 9, 0, {end_row = 9, end_col = 3, hl_group = 'Error'}) + api.nvim_buf_set_extmark(0, ns, 19, 0, {end_row = 19, sign_text = 'S3'}) + api.nvim_buf_set_extmark(0, ns, 19, 0, {end_row = 19, end_col = 3, hl_group = 'Error'}) + api.nvim_buf_set_extmark(0, ns, 29, 0, {end_row = 29, sign_text = 'S4'}) + api.nvim_buf_set_extmark(0, ns, 29, 0, {end_row = 29, end_col = 3, hl_group = 'Error'}) + api.nvim_buf_set_extmark(0, ns, 30, 0, {end_row = 30, sign_text = 'S5'}) + api.nvim_buf_set_extmark(0, ns, 30, 0, {end_row = 30, end_col = 3, hl_group = 'Error'}) + command('0d29') + + screen:expect{grid=[[ + S1S2S3S4{4:^foo} | + S5{1: }{4:foo} | + {2:~ }|*7 + 29 fewer lines | + ]]} + + api.nvim_buf_clear_namespace(0, ns, 0, -1) + end) end) describe('decorations: virt_text', function() |