fix(drawline): combine extmark highligh with area hl correctly

fixes #23734

Get rid of the weird attr_pri dance which always seemed like a kludge:

    if (!attr_pri) {
      wlv.char_attr = hl_combine_attr(wlv.char_attr, extmark_attr);
    } else {
      wlv.char_attr = hl_combine_attr(extmark_attr, wlv.char_attr);
    }

Instead combine extmark attrs with (old-skool) syntax attrs in a consistent way and then combine that with attr_pri and the rest in an _unified_ code path

fixes #23722

Co-authored-by: luukvbaal <luukvbaal@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
bfredl
2023-05-24 14:33:09 +02:00
parent aa9d46b672
commit 455bca1ba8
3 changed files with 108 additions and 33 deletions

View File

@@ -526,6 +526,41 @@ describe('highlight', function()
})
end)
it("'diff', syntax and extmark", function()
local screen = Screen.new(25,10)
screen:attach()
exec([[
new
call setline(1, ['', '01234 6789'])
windo diffthis
wincmd w
syn match WarningMsg "^.*$"
call nvim_buf_add_highlight(0, -1, 'ErrorMsg', 1, 2, 8)
]])
screen:expect([[
{1: }^ |
{1: }{2:01}{3:234 67}{2:89}{5: }|
{4:~ }|
{4:~ }|
{7:[No Name] [+] }|
{1: } |
{1: }{6:-----------------------}|
{4:~ }|
{8:[No Name] }|
|
]],{
[0] = {Screen.colors.WebGray, foreground = Screen.colors.DarkBlue},
[1] = {background = Screen.colors.Grey, foreground = Screen.colors.Blue4},
[2] = {foreground = Screen.colors.Red, background = Screen.colors.LightBlue},
[3] = {foreground = Screen.colors.Grey100, background = Screen.colors.LightBlue},
[4] = {bold = true, foreground = Screen.colors.Blue},
[5] = {background = Screen.colors.LightBlue},
[6] = {bold = true, background = Screen.colors.LightCyan, foreground = Screen.colors.Blue1},
[7] = {reverse = true, bold = true},
[8] = {reverse = true},
})
end)
end)
describe("'listchars' highlight", function()