fix(extmarks): don't show virt lines for end mark (#23792)

This commit is contained in:
zeertzjq 2023-05-28 17:22:25 +08:00 committed by GitHub
parent f29acc5073
commit 4dd43e31db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View File

@ -603,7 +603,7 @@ int decor_virt_lines(win_T *wp, linenr_T lnum, VirtLines *lines, TriState has_fo
mtkey_t mark = marktree_itr_current(itr);
if (mark.pos.row < 0 || mark.pos.row >= end_row) {
break;
} else if (marktree_decor_level(mark) < kDecorLevelVirtLine) {
} else if (mt_end(mark) || marktree_decor_level(mark) < kDecorLevelVirtLine) {
goto next_mark;
}
bool above = mark.pos.row > (lnum - 2);

View File

@ -2978,6 +2978,30 @@ if (h->n_buckets < new_n_buckets) { // expand
]]}
end)
it('does not show twice if end_row or end_col is specified #18622', function()
insert([[
aaa
bbb
ccc
ddd]])
meths.buf_set_extmark(0, ns, 0, 0, {end_row = 2, virt_lines = {{{'VIRT LINE 1', 'NonText'}}}})
meths.buf_set_extmark(0, ns, 3, 0, {end_col = 2, virt_lines = {{{'VIRT LINE 2', 'NonText'}}}})
screen:expect{grid=[[
aaa |
{1:VIRT LINE 1} |
bbb |
ccc |
dd^d |
{1:VIRT LINE 2} |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
|
]]}
end)
end)
describe('decorations: signs', function()