fix(api): make getting explicit empty hl in virtual text work (#28697)

This commit is contained in:
zeertzjq
2024-05-12 05:39:33 +08:00
committed by GitHub
parent c1396afa7c
commit 4e5c633ed4
5 changed files with 55 additions and 8 deletions

View File

@@ -2407,6 +2407,7 @@ describe('float window', function()
command('hi B0 guibg=Red guifg=Black')
command('hi B1 guifg=White')
api.nvim_win_set_config(win, {
title = {{"🦄"}, {"BB", {"B0", "B1"}}}, title_pos = "right",
footer= {{"🦄"}, {"BB", {"B0", "B1"}}}, footer_pos = "right",
@@ -2443,6 +2444,47 @@ describe('float window', function()
|
]]}
end
eq({{"🦄"}, {"BB", {"B0", "B1"}}}, api.nvim_win_get_config(win).title)
eq({{"🦄"}, {"BB", {"B0", "B1"}}}, api.nvim_win_get_config(win).footer)
api.nvim_win_set_config(win, {
title = {{"🦄", ""}, {"BB", {"B0", "B1", ""}}}, title_pos = "left",
footer= {{"🦄", ""}, {"BB", {"B0", "B1", ""}}}, footer_pos = "left",
})
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|*6
[3:----------------------------------------]|
## grid 2
^ |
{0:~ }|*5
## grid 3
|
## grid 4
{5:╔}🦄{7:BB}{5:═════╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
{5:╚}🦄{7:BB}{5:═════╝}|
]], float_pos={
[4] = { 1001, "NW", 1, 2, 5, true }
}, win_viewport={
[2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}}
else
screen:expect{grid=[[
^ |
{0:~ }|
{0:~ }{5:╔}🦄{7:BB}{5:═════╗}{0: }|
{0:~ }{5:║}{1: halloj! }{5:║}{0: }|
{0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
{0:~ }{5:╚}🦄{7:BB}{5:═════╝}{0: }|
|
]]}
end
eq({{"🦄", ""}, {"BB", {"B0", "B1", ""}}}, api.nvim_win_get_config(win).title)
eq({{"🦄", ""}, {"BB", {"B0", "B1", ""}}}, api.nvim_win_get_config(win).footer)
end)
it('terminates border on edge of viewport when window extends past viewport', function()