mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 09:31:47 +00:00
feat(extmarks): add virt_text_repeat_linebreak flag (#26625)
Problem: Unable to predict which byte-offset to place virtual text to
make it repeat visually in the wrapped part of a line.
Solution: Add a flag to nvim_buf_set_extmark() that causes virtual
text to repeat in wrapped lines.
This commit is contained in:
@@ -2094,6 +2094,32 @@ describe('extmark decorations', function()
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('virt_text_repeat_linebreak repeats virtual text on wrapped lines', function()
|
||||
screen:try_resize(40, 5)
|
||||
meths.set_option_value('breakindent', true, {})
|
||||
insert(example_text)
|
||||
meths.buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_pos = 'overlay', virt_text_repeat_linebreak = true })
|
||||
meths.buf_set_extmark(0, ns, 1, 3, { virt_text = {{'│', 'NonText'}}, virt_text_pos = 'overlay', virt_text_repeat_linebreak = true })
|
||||
command('norm gg')
|
||||
screen:expect{grid=[[
|
||||
^for _,item in ipairs(items) do |
|
||||
{1:│} {1:│}local text, hl_id_cell, count = unpa|
|
||||
{1:│} {1:│}ck(item) |
|
||||
if hl_id_cell ~= nil then |
|
||||
|
|
||||
]]}
|
||||
meths.buf_clear_namespace(0, ns, 0, -1)
|
||||
meths.buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_repeat_linebreak = true, virt_text_win_col = 0 })
|
||||
meths.buf_set_extmark(0, ns, 1, 0, { virt_text = {{'│', 'NonText'}}, virt_text_repeat_linebreak = true, virt_text_win_col = 2 })
|
||||
screen:expect{grid=[[
|
||||
^for _,item in ipairs(items) do |
|
||||
{1:│} {1:│} local text, hl_id_cell, count = unpa|
|
||||
{1:│} {1:│} ck(item) |
|
||||
if hl_id_cell ~= nil then |
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('decorations: inline virtual text', function()
|
||||
|
||||
Reference in New Issue
Block a user