perf(extmarks): better track whether namespace has extmarks (#28615)

This avoids redraw when adding/removing an empty namespace for a window.

This also avoids marktree traversal when clearing a namespace that has
already been cleared, which is added as a benchmark.
This commit is contained in:
zeertzjq
2024-05-03 18:02:25 +08:00
committed by GitHub
parent cf9f002f31
commit d44ed3a885
6 changed files with 89 additions and 11 deletions

View File

@@ -129,13 +129,13 @@ function M.on_yank(opts)
yank_cancel()
end
vim.api.nvim_win_add_ns(winid, yank_ns)
M.range(bufnr, yank_ns, higroup, "'[", "']", {
regtype = event.regtype,
inclusive = event.inclusive,
priority = opts.priority or M.priorities.user,
_scoped = true,
})
vim.api.nvim_win_add_ns(winid, yank_ns)
yank_cancel = function()
yank_timer = nil