This commit is contained in:
glepnir 2024-05-05 10:04:15 -04:00 committed by GitHub
commit de795b5b49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 0 deletions

View File

@ -800,6 +800,7 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear
tl_ret = true;
}
may_trigger_modechanged();
update_screen();
init_history();
s->hiscnt = get_hislen(); // set hiscnt to impossible history value

View File

@ -2386,6 +2386,40 @@ describe('highlight namespaces', function()
}
end)
it('#update screen when highlight changed in event callback', function ()
command('set cursorline number')
exec_lua[[
vim.api.nvim_create_autocmd('ModeChanged', {
callback = function()
vim.api.nvim_set_hl(0, 'CursorLineNr', { bg = 'red' })
vim.api.nvim_set_hl(0, 'CursorLine', { bg = 'green' })
end,
})
]]
feed(':')
screen:expect({
grid = [[
{11: 1 }{12: }|
{1:~ }|*8
:^ |
]],
attr_ids = {
[1] = { foreground = Screen.colors.Blue, bold = true },
[2] = { background = Screen.colors.DarkGrey },
[3] = { italic = true, background = Screen.colors.DarkOrange4, foreground = Screen.colors.DarkCyan },
[4] = { background = Screen.colors.Magenta4 },
[5] = { background = Screen.colors.Magenta4, foreground = Screen.colors.Crimson },
[6] = { bold = true, reverse = true },
[7] = { reverse = true },
[8] = { foreground = Screen.colors.Grey20 },
[9] = { foreground = Screen.colors.Blue },
[10] = { bold = true, foreground = Screen.colors.SeaGreen },
[11] = { background = Screen.colors.Red },
[12] = { background = Screen.colors.Green },
},
})
end)
it('winhl does not accept invalid value #24586', function()
local res = exec_lua([[
local curwin = vim.api.nvim_get_current_win()