fix(ui2): cursor flicker in cmdline with matchit #41245

Problem:
The cmdline_hide callback causes an unnecessary cursor move to the cmdline,
before the normal redraw updates the cursor back to the current window. This
appears as "flicker" when using plugins such as matchit (legacy ":" mappings
instead of "<cmd>" mappings).

Solution:
Skip the immediate redraw for cmdline_hide events. The normal redraw
still updates the cursor after the cmdline window is hidden.
This commit is contained in:
not_compiled
2026-08-31 04:03:59 +05:30
committed by GitHub
parent de83b54ddf
commit 7dc0592fca

View File

@@ -157,7 +157,10 @@ local function ui_callback(redraw_msg, event, ...)
M.check_targets()
handler(...)
-- Cmdline mode, non-fast message and non-empty showcmd require an immediate redraw.
if M.cmd[event] or redraw_msg or (event == 'msg_showcmd' and select(1, ...)[1]) then
if
(M.cmd[event] or redraw_msg or (event == 'msg_showcmd' and select(1, ...)[1]))
and event ~= 'cmdline_hide'
then
M.redrawing = true
api.nvim__redraw({
flush = handler ~= M.cmd.cmdline_hide or nil,