neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 4dd43e31db8fa23b5189e074cff94f1491035aac
parent f29acc507305a7f4323a3233dc3867dfbe00132b
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sun, 28 May 2023 17:22:25 +0800

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


Diffstat:
Msrc/nvim/decoration.c | 2+-
Mtest/functional/ui/decorations_spec.lua | 24++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c @@ -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); diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua @@ -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()