mirror of
https://github.com/neovim/neovim.git
synced 2025-09-11 13:58:18 +00:00
fix(tohtml): properly handle multiple hl groups #29012
Problem: :TOhtml doesn't properly handle virtual text when it has multiple highlight groups. It also improperly calculates position offset for multi-byte virt_text characters. Solution: Apply the `vim.api.nvim_strwidth` broadly to properly calculate character offset, and handle the cases where the `hl` argument can be a table of multiple hl groups.
This commit is contained in:
@@ -287,7 +287,13 @@ describe(':TOhtml', function()
|
||||
0,
|
||||
{ virt_text = { { 'foo' } }, virt_text_pos = 'overlay' }
|
||||
)
|
||||
api.nvim_buf_set_extmark(0, ns, 2, 0, { virt_text = { { 'foo' } }, virt_text_pos = 'inline' })
|
||||
api.nvim_buf_set_extmark(
|
||||
0,
|
||||
ns,
|
||||
2,
|
||||
0,
|
||||
{ virt_text = { { 'fo┊o', { 'Conceal', 'Comment' } } }, virt_text_pos = 'inline' }
|
||||
)
|
||||
--api.nvim_buf_set_extmark(0,ns,3,0,{virt_text={{'foo'}},virt_text_pos='right_align'})
|
||||
run_tohtml_and_assert(screen)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user