mirror of
https://github.com/neovim/neovim.git
synced 2025-12-11 00:52:44 +00:00
fix(ui2): only redraw when necessary #36457
Problem: Until now the UI callback called nvim__redraw() liberally.
It should only be needed when Nvim does not update the screen
in its own event loop.
Solution: Identify which UI events require immediate redrawing.
This commit is contained in:
@@ -42,11 +42,14 @@ local function ui_callback(event, ...)
|
|||||||
local handler = ext.msg[event] or ext.cmd[event]
|
local handler = ext.msg[event] or ext.cmd[event]
|
||||||
ext.check_targets()
|
ext.check_targets()
|
||||||
handler(...)
|
handler(...)
|
||||||
api.nvim__redraw({
|
-- Cmdline mode and non-empty showcmd requires an immediate redraw.
|
||||||
flush = handler ~= ext.cmd.cmdline_hide or nil,
|
if ext.cmd[event] or event == 'msg_showcmd' and select(1, ...)[1] then
|
||||||
cursor = handler == ext.cmd[event] and true or nil,
|
api.nvim__redraw({
|
||||||
win = handler == ext.cmd[event] and ext.wins.cmd or nil,
|
flush = handler ~= ext.cmd.cmdline_hide or nil,
|
||||||
})
|
cursor = handler == ext.cmd[event] and true or nil,
|
||||||
|
win = handler == ext.cmd[event] and ext.wins.cmd or nil,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local scheduled_ui_callback = vim.schedule_wrap(ui_callback)
|
local scheduled_ui_callback = vim.schedule_wrap(ui_callback)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user