aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-05-26 10:27:12 -0700
committerGitHub <noreply@github.com>2024-05-26 10:27:12 -0700
commiteb37241d38ad35b9e6bfac6379dd10e60aa0350c (patch)
tree8053934aee3aac93bf1a9bd33d9c135bae677a2c /test
parentdd54e81551bd063a1ece46eba64c5ed45f172476 (diff)
downloadrneovim-eb37241d38ad35b9e6bfac6379dd10e60aa0350c.tar.gz
rneovim-eb37241d38ad35b9e6bfac6379dd10e60aa0350c.tar.bz2
rneovim-eb37241d38ad35b9e6bfac6379dd10e60aa0350c.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/functional/plugin/tohtml_spec.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/functional/plugin/tohtml_spec.lua b/test/functional/plugin/tohtml_spec.lua
index 200a5f34b2..be5bada901 100644
--- a/test/functional/plugin/tohtml_spec.lua
+++ b/test/functional/plugin/tohtml_spec.lua
@@ -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)