fix(highlight): preserve background transparency in 'winblend' #34302

Problem: When using 'winblend', transparent backgrounds (-1) are forced
to default colors (usually black) during attribute blending, breaking
the transparency effect.

Solution: Check original background colors before blending in
hl_blend_attrs(). If both background and foreground originally had
transparent backgrounds, preserve transparency instead of forcing
default colors.
This commit is contained in:
glepnir
2025-06-09 23:24:46 +08:00
committed by GitHub
parent 8fadb80b3a
commit 336b46a879
3 changed files with 100 additions and 82 deletions

View File

@@ -2672,6 +2672,11 @@ describe('pager', function()
[10] = { background = Screen.colors.Grey100, bold = true, foreground = tonumber('0xe5e5ff') },
[11] = { background = Screen.colors.Grey100, bold = true, foreground = tonumber('0x2b8452') },
[12] = { bold = true, reverse = true },
[13] = { foreground = Screen.colors.Grey0 },
[14] = { foreground = Screen.colors.Grey90 },
[15] = { foreground = tonumber('0x00000c') },
[16] = { bold = true, foreground = tonumber('0xe5e5ff') },
[17] = { bold = true, foreground = tonumber('0x2b8452') },
})
command('set more')
@@ -3005,60 +3010,52 @@ aliquip ex ea commodo consequat.]]
it('clears "-- more --" message', function()
command('hi MsgArea guisp=Yellow blend=10')
feed(':echon join(range(20), "\\n")<cr>')
screen:expect {
grid = [[
{7:0}{8: }|
{9:1}{10: }|
{9:2}{10: }|
{9:3}{10: }|
{9:4}{10: }|
{9:5}{10: }|
{9:6}{10: }|
{11:--}{8: }{11:More}{8: }{11:--}{8:^ }|
]],
}
screen:expect([[
{13:0}{14: }|
{15:1}{16: }|
{15:2}{16: }|
{15:3}{16: }|
{15:4}{16: }|
{15:5}{16: }|
{15:6}{16: }|
{17:--}{14: }{17:More}{14: }{17:--}{14:^ }|
]])
feed('j')
screen:expect {
grid = [[
{7:1}{8: }|
{9:2}{10: }|
{9:3}{10: }|
{9:4}{10: }|
{9:5}{10: }|
{9:6}{10: }|
{9:7}{10: }|
{11:--}{8: }{11:More}{8: }{11:--}{8:^ }|
]],
}
screen:expect([[
{13:1}{14: }|
{15:2}{16: }|
{15:3}{16: }|
{15:4}{16: }|
{15:5}{16: }|
{15:6}{16: }|
{15:7}{16: }|
{17:--}{14: }{17:More}{14: }{17:--}{14:^ }|
]])
feed('k')
screen:expect {
grid = [[
{7:0}{8: }|
{9:1}{10: }|
{9:2}{10: }|
{9:3}{10: }|
{9:4}{10: }|
{9:5}{10: }|
{9:6}{10: }|
{11:--}{8: }{11:More}{8: }{11:--}{8:^ }|
]],
}
screen:expect([[
{13:0}{14: }|
{15:1}{16: }|
{15:2}{16: }|
{15:3}{16: }|
{15:4}{16: }|
{15:5}{16: }|
{15:6}{16: }|
{17:--}{14: }{17:More}{14: }{17:--}{14:^ }|
]])
feed('j')
screen:expect {
grid = [[
{7:1}{8: }|
{9:2}{10: }|
{9:3}{10: }|
{9:4}{10: }|
{9:5}{10: }|
{9:6}{10: }|
{9:7}{10: }|
{11:--}{8: }{11:More}{8: }{11:--}{8:^ }|
]],
}
screen:expect([[
{13:1}{14: }|
{15:2}{16: }|
{15:3}{16: }|
{15:4}{16: }|
{15:5}{16: }|
{15:6}{16: }|
{15:7}{16: }|
{17:--}{14: }{17:More}{14: }{17:--}{14:^ }|
]])
end)
it('with :!cmd does not crash on resize', function()