aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_extui.lua
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2025-11-17 19:34:02 +0100
committerGitHub <noreply@github.com>2025-11-17 10:34:02 -0800
commitc4ac36bfd9bc9826dde01839d10d0e65a7b3c9e2 (patch)
treedf6322ba6c1f929bf85a69bb6eb023d4f52d1374 /runtime/lua/vim/_extui.lua
parent5df1112e5f2112ce4f3b1fcf9ca78383fe5c9fee (diff)
downloadrneovim-c4ac36bfd9bc9826dde01839d10d0e65a7b3c9e2.tar.gz
rneovim-c4ac36bfd9bc9826dde01839d10d0e65a7b3c9e2.tar.bz2
rneovim-c4ac36bfd9bc9826dde01839d10d0e65a7b3c9e2.zip
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.
Diffstat (limited to 'runtime/lua/vim/_extui.lua')
-rw-r--r--runtime/lua/vim/_extui.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/runtime/lua/vim/_extui.lua b/runtime/lua/vim/_extui.lua
index bbb534723f..f9da5629d5 100644
--- a/runtime/lua/vim/_extui.lua
+++ b/runtime/lua/vim/_extui.lua
@@ -42,11 +42,14 @@ local function ui_callback(event, ...)
local handler = ext.msg[event] or ext.cmd[event]
ext.check_targets()
handler(...)
- api.nvim__redraw({
- 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,
- })
+ -- Cmdline mode and non-empty showcmd requires an immediate redraw.
+ if ext.cmd[event] or event == 'msg_showcmd' and select(1, ...)[1] then
+ api.nvim__redraw({
+ 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
local scheduled_ui_callback = vim.schedule_wrap(ui_callback)