fix(api): get virtual text with multiple hl properly (#25307)

This commit is contained in:
zeertzjq
2023-09-22 17:56:05 +08:00
committed by GitHub
parent 64e8a3c4d1
commit b7763d7f6b
5 changed files with 74 additions and 46 deletions

View File

@@ -1524,16 +1524,19 @@ describe('API/extmarks', function()
sign_hl_group = "Statement",
sign_text = ">>",
spell = true,
virt_lines = { { { "lines", "Statement" } }},
virt_lines = {
{ { "lines", "Macro" }, { "???" } },
{ { "stack", { "Type", "Search" } }, { "!!!" } },
},
virt_lines_above = true,
virt_lines_leftcol = true,
virt_text = { { "text", "Statement" } },
virt_text = { { "text", "Macro" }, { "???" }, { "stack", { "Type", "Search" } } },
virt_text_hide = true,
virt_text_pos = "right_align",
})
set_extmark(ns, marks[2], 0, 0, {
priority = 0,
virt_text = { { "text", "Statement" } },
virt_text = { { "", "Macro" }, { "", { "Type", "Search" } }, { "" } },
virt_text_win_col = 1,
})
eq({0, 0, {
@@ -1553,10 +1556,13 @@ describe('API/extmarks', function()
sign_hl_group = "Statement",
sign_text = ">>",
spell = true,
virt_lines = { { { "lines", "Statement" } }},
virt_lines = {
{ { "lines", "Macro" }, { "???" } },
{ { "stack", { "Type", "Search" } }, { "!!!" } },
},
virt_lines_above = true,
virt_lines_leftcol = true,
virt_text = { { "text", "Statement" } },
virt_text = { { "text", "Macro" }, { "???" }, { "stack", { "Type", "Search" } } },
virt_text_hide = true,
virt_text_pos = "right_align",
} }, get_extmark_by_id(ns, marks[1], { details = true }))
@@ -1564,7 +1570,7 @@ describe('API/extmarks', function()
ns_id = 1,
right_gravity = true,
priority = 0,
virt_text = { { "text", "Statement" } },
virt_text = { { "", "Macro" }, { "", { "Type", "Search" } }, { "" } },
virt_text_hide = false,
virt_text_pos = "win_col",
virt_text_win_col = 1,