This commit is contained in:
hrsh7th
2022-01-07 00:38:42 +09:00
parent 1b94aacada
commit 796f925915
4 changed files with 29 additions and 4 deletions

View File

@@ -180,4 +180,27 @@ misc.deprecated = function(fn, msg)
end
end
--Redraw
misc.redraw = setmetatable({
doing = false,
force = false,
}, {
__call = function(self, force)
if self.doing then
return
end
self.doing = true
self.force = not not force
vim.schedule(function()
if self.force then
vim.cmd([[redraw!]])
else
vim.cmd([[redraw]])
end
self.doing = false
self.force = false
end)
end
})
return misc

View File

@@ -176,7 +176,7 @@ window.update = function(self)
-- In cmdline, vim does not redraw automatically.
if api.is_cmdline_mode() then
vim.api.nvim_win_call(self.win, function()
vim.cmd([[redraw]])
misc.redraw()
end)
end
end