mirror of https://github.com/folke/lazy.nvim.git
fix(ui): save/restore view right before/after rendering
This commit is contained in:
parent
a75d950b8f
commit
5d334b9f57
|
@ -147,13 +147,7 @@ end
|
|||
|
||||
function M:update()
|
||||
if self.buf and vim.api.nvim_buf_is_valid(self.buf) then
|
||||
vim.bo[self.buf].modifiable = true
|
||||
local view = vim.api.nvim_win_call(self.view.win, vim.fn.winsaveview)
|
||||
self.render:update()
|
||||
vim.api.nvim_win_call(self.view.win, function()
|
||||
vim.fn.winrestview(view)
|
||||
end)
|
||||
vim.bo[self.buf].modifiable = false
|
||||
vim.cmd.redraw()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -74,7 +74,17 @@ function M:update()
|
|||
end
|
||||
|
||||
self:trim()
|
||||
|
||||
vim.bo[self.view.buf].modifiable = true
|
||||
local view = vim.api.nvim_win_call(self.view.win, vim.fn.winsaveview)
|
||||
|
||||
self:render(self.view.buf)
|
||||
|
||||
vim.api.nvim_win_call(self.view.win, function()
|
||||
vim.fn.winrestview(view)
|
||||
end)
|
||||
vim.bo[self.view.buf].modifiable = false
|
||||
|
||||
vim.diagnostic.set(
|
||||
Config.ns,
|
||||
self.view.buf,
|
||||
|
|
Loading…
Reference in New Issue