fix(decor): don't draw invalidated virtual lines (#29858)

This commit is contained in:
luukvbaal 2024-07-26 03:04:17 +02:00 committed by GitHub
parent 41b70a0dea
commit 5af9c065ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View File

@ -924,7 +924,7 @@ int decor_virt_lines(win_T *wp, linenr_T lnum, VirtLines *lines, TriState has_fo
while (true) { while (true) {
MTKey mark = marktree_itr_current(itr); MTKey mark = marktree_itr_current(itr);
DecorVirtText *vt = mt_decor_virt(mark); DecorVirtText *vt = mt_decor_virt(mark);
if (ns_in_win(mark.ns, wp)) { if (!mt_invalid(mark) && ns_in_win(mark.ns, wp)) {
while (vt) { while (vt) {
if (vt->flags & kVTIsLines) { if (vt->flags & kVTIsLines) {
bool above = vt->flags & kVTLinesAbove; bool above = vt->flags & kVTLinesAbove;

View File

@ -4948,6 +4948,28 @@ if (h->n_buckets < new_n_buckets) { // expand
| |
]]) ]])
end) end)
it('not drawn when invalid', function()
api.nvim_buf_set_lines(0, 0, -1, false, { 'foo', 'bar' })
api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_lines = {{{'VIRT1'}}}, invalidate = true })
screen:expect({
grid = [[
^foo |
VIRT1 |
bar |
{1:~ }|*8
|
]]
})
feed('dd')
screen:expect({
grid = [[
^bar |
{1:~ }|*10
|
]]
})
end)
end) end)
describe('decorations: signs', function() describe('decorations: signs', function()