fix(extmarks): skip virt_text if it is out of window (#25658)

This commit is contained in:
zeertzjq
2023-10-15 19:36:19 +08:00
committed by GitHub
parent 75b488d3ef
commit 0818d65528
2 changed files with 30 additions and 5 deletions

View File

@@ -1456,6 +1456,24 @@ describe('extmark decorations', function()
]]}
end)
it('virtual text win_col out of window does not break display #25645', function()
screen:try_resize(51, 6)
command('vnew')
meths.buf_set_lines(0, 0, -1, false, { string.rep('a', 50) })
screen:expect{grid=[[
^aaaaaaaaaaaaaaaaaaaaaaaaa│ |
aaaaaaaaaaaaaaaaaaaaaaaaa│{1:~ }|
{1:~ }│{1:~ }|
{1:~ }│{1:~ }|
{41:[No Name] [+] }{40:[No Name] }|
|
]]}
local extmark_opts = { virt_text_win_col = 35, virt_text = { { ' ', 'Comment' } } }
meths.buf_set_extmark(0, ns, 0, 0, extmark_opts)
screen:expect_unchanged()
assert_alive()
end)
it('can have virtual text on folded line', function()
insert([[
11111