aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-22 17:56:05 +0800
committerGitHub <noreply@github.com>2023-09-22 17:56:05 +0800
commitb7763d7f6b7fdcabe06658c664457df8bc147563 (patch)
treeb85dad8a556924e09c4c4fa549e171ea634f1a75 /test
parent64e8a3c4d19eab40888fbac36b96e97bd9d68c42 (diff)
downloadrneovim-b7763d7f6b7fdcabe06658c664457df8bc147563.tar.gz
rneovim-b7763d7f6b7fdcabe06658c664457df8bc147563.tar.bz2
rneovim-b7763d7f6b7fdcabe06658c664457df8bc147563.zip
fix(api): get virtual text with multiple hl properly (#25307)
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/extmark_spec.lua18
-rw-r--r--test/functional/api/window_spec.lua22
-rw-r--r--test/functional/ui/decorations_spec.lua5
3 files changed, 34 insertions, 11 deletions
diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua
index c4449bc201..133ec67942 100644
--- a/test/functional/api/extmark_spec.lua
+++ b/test/functional/api/extmark_spec.lua
@@ -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,
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 44d4470337..6737c2d15b 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -895,13 +895,14 @@ describe('API/win', function()
it('includes border', function()
local b = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' }
local win = meths.open_win(0, true, {
- relative='win', row=3, col=3, width=12, height=3,
- border = b,
+ relative='win', row=3, col=3, width=12, height=3,
+ border = b,
})
local cfg = meths.win_get_config(win)
eq(b, cfg.border)
end)
+
it('includes border with highlight group', function()
local b = {
{'a', 'Normal'},
@@ -914,12 +915,25 @@ describe('API/win', function()
{'h', 'PreProc'},
}
local win = meths.open_win(0, true, {
- relative='win', row=3, col=3, width=12, height=3,
- border = b,
+ relative='win', row=3, col=3, width=12, height=3,
+ border = b,
})
local cfg = meths.win_get_config(win)
eq(b, cfg.border)
end)
+
+ it('includes title and footer', function()
+ local title = { {'A', {'StatusLine', 'TabLine'}}, {'B'}, {'C', 'WinBar'} }
+ local footer = { {'A', 'WinBar'}, {'B'}, {'C', {'StatusLine', 'TabLine'}} }
+ local win = meths.open_win(0, true, {
+ relative='win', row=3, col=3, width=12, height=3,
+ border = 'single', title = title, footer = footer,
+ })
+
+ local cfg = meths.win_get_config(win)
+ eq(title, cfg.title)
+ eq(footer, cfg.footer)
+ end)
end)
end)
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index c4fd6379f3..f378c50792 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -1464,7 +1464,7 @@ describe('extmark decorations', function()
end)
it('can have virtual text which combines foreground and background groups', function()
- screen:try_resize(20, 3)
+ screen:try_resize(20, 5)
screen:set_default_attr_ids {
[1] = {bold=true, foreground=Screen.colors.Blue};
@@ -1494,8 +1494,11 @@ describe('extmark decorations', function()
meths.buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'eol' })
meths.buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'right_align' })
meths.buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'inline' })
+ meths.buf_set_extmark(0, ns, 0, 0, { virt_lines = { vt, vt } })
screen:expect{grid=[[
{2:a}{3:b}{4:c}{5:d}{6:X}#^# {2:a}{3:b}{4:c}{5:d}{6:X} {2:a}{3:b}{4:c}{5:d}{6:X}|
+ {2:a}{3:b}{4:c}{5:d}{6:X} |
+ {2:a}{3:b}{4:c}{5:d}{6:X} |
{1:~ }|
|
]]}