perf(redraw): only redraw Visual area when cursor has moved (#27340)

This commit is contained in:
zeertzjq
2024-02-05 11:08:52 +08:00
committed by GitHub
parent 1ed6b9cd2c
commit 18e62c1bdb
4 changed files with 37 additions and 5 deletions

View File

@@ -39,6 +39,7 @@ describe('decorations providers', function()
[16] = {special = Screen.colors.Red, undercurl = true},
[17] = {foreground = Screen.colors.Red},
[18] = {bold = true, foreground = Screen.colors.SeaGreen};
[19] = {bold = true};
}
end)
@@ -738,6 +739,25 @@ describe('decorations providers', function()
|
]]}
end)
it('is not invoked repeatedly in Visual mode with vim.schedule() #20235', function()
exec_lua([[_G.cnt = 0]])
setup_provider([[
function on_do(event, ...)
if event == 'win' then
vim.schedule(function() end)
_G.cnt = _G.cnt + 1
end
end
]])
feed('v')
screen:expect([[
^ |
{1:~ }|*6
{19:-- VISUAL --} |
]])
eq(2, exec_lua([[return _G.cnt]]))
end)
end)
local example_text = [[