aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2022-10-14 20:46:26 +0100
committerGitHub <noreply@github.com>2022-10-14 20:46:26 +0100
commitcb7da02701d542d3c1618f44f6217944986f09f9 (patch)
treec85f76108cafd55733f8f56ab13081cb55bdb286
parente6f7e038b8bbca487e78ebfc6fe21d6852330623 (diff)
parent546b294e74ac10d0a5e1216dd530fc96bdc66f29 (diff)
downloadrneovim-cb7da02701d542d3c1618f44f6217944986f09f9.tar.gz
rneovim-cb7da02701d542d3c1618f44f6217944986f09f9.tar.bz2
rneovim-cb7da02701d542d3c1618f44f6217944986f09f9.zip
Merge pull request #20645 from lewis6991/fix/decor_redraw_same_id
fix(decoration): redraw correctly when re-using ids
-rw-r--r--src/nvim/extmark.c1
-rw-r--r--test/functional/ui/decorations_spec.lua35
2 files changed, 36 insertions, 0 deletions
diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c
index 176ad0d5c8..df87cc8ab6 100644
--- a/src/nvim/extmark.c
+++ b/src/nvim/extmark.c
@@ -112,6 +112,7 @@ void extmark_set(buf_T *buf, uint32_t ns_id, uint32_t *idp, int row, colnr_T col
marktree_revise(buf->b_marktree, itr, decor_level, old_mark);
goto revised;
}
+ decor_remove(buf, old_mark.pos.row, old_mark.pos.row, old_mark.decor_full);
marktree_del_itr(buf->b_marktree, itr, false);
}
} else {
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 0a5eefbf38..9448674a41 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -2085,4 +2085,39 @@ describe('decorations: virt_text', function()
]]}
end)
+ it('redraws correctly when re-using extmark ids', function()
+ command 'normal 5ohello'
+
+ screen:expect{grid=[[
+ |
+ hello |
+ hello |
+ hello |
+ hello |
+ hell^o |
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ |
+ ]]}
+
+ local ns = meths.create_namespace('ns')
+ for row = 1, 5 do
+ meths.buf_set_extmark(0, ns, row, 0, { id = 1, virt_text = {{'world', 'Normal'}} })
+ end
+
+ screen:expect{grid=[[
+ |
+ hello |
+ hello |
+ hello |
+ hello |
+ hell^o world |
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ |
+ ]]}
+ end)
+
end)