refactor(message): propagate highlight id instead of attrs

Problem:  Highlight group id is not propagated to the end of the message call
          stack, where ext_messages are emitted.
Solution: Refactor message functions to pass along highlight group id
          instead of attr id.
This commit is contained in:
Luuk van Baal
2024-02-20 17:25:57 +01:00
parent 5a86360400
commit 5cfa7a72f8
45 changed files with 441 additions and 473 deletions

View File

@@ -33,42 +33,42 @@ describe('ext_hlstate detailed highlights', function()
api.nvim_buf_add_highlight(0, -1, 'Statement', 1, 5, -1)
command('/th co')
screen:expect(
[[
screen:expect {
grid = [[
these are {1:some} lines |
^wi{2:th }{4:co}{3:lorful text} |
{5:~ }|*5
{8:search hit BOTTOM, continuing at TOP}{7: }|
{8:search hit BOTTOM, continuing at TOP}{6: }|
]],
{
attr_ids = {
[1] = {
{ foreground = Screen.colors.Magenta },
{ { hi_name = 'Constant', kind = 'syntax' } },
{ foreground = Screen.colors.Magenta1 },
{ { kind = 'syntax', hi_name = 'Constant' } },
},
[2] = {
{ background = Screen.colors.Yellow },
{ { hi_name = 'Search', ui_name = 'Search', kind = 'ui' } },
{ background = Screen.colors.Yellow1 },
{ { kind = 'ui', ui_name = 'Search', hi_name = 'Search' } },
},
[3] = {
{ bold = true, foreground = Screen.colors.Brown },
{ { hi_name = 'Statement', kind = 'syntax' } },
{ foreground = Screen.colors.Brown, bold = true },
{ { kind = 'syntax', hi_name = 'Statement' } },
},
[4] = {
{ bold = true, background = Screen.colors.Yellow, foreground = Screen.colors.Brown },
{ background = Screen.colors.Yellow1, bold = true, foreground = Screen.colors.Brown },
{ 3, 2 },
},
[5] = {
{ bold = true, foreground = Screen.colors.Blue1 },
{ { hi_name = 'NonText', ui_name = 'EndOfBuffer', kind = 'ui' } },
{ foreground = Screen.colors.Blue, bold = true },
{ { kind = 'ui', ui_name = 'EndOfBuffer', hi_name = 'NonText' } },
},
[6] = {
{ foreground = Screen.colors.Red },
{ { hi_name = 'WarningMsg', ui_name = 'WarningMsg', kind = 'ui' } },
[6] = { {}, { { kind = 'ui', ui_name = 'MsgArea', hi_name = 'MsgArea' } } },
[7] = {
{ foreground = Screen.colors.Red1 },
{ { kind = 'syntax', hi_name = 'WarningMsg' } },
},
[7] = { {}, { { hi_name = 'MsgArea', ui_name = 'MsgArea', kind = 'ui' } } },
[8] = { { foreground = Screen.colors.Red }, { 7, 6 } },
}
)
[8] = { { foreground = Screen.colors.Red1 }, { 6, 7 } },
},
}
end)
it('work with cleared UI highlights', function()