feat(ui): keep cursor position when rendering view

This commit is contained in:
Folke Lemaitre 2024-06-26 22:45:21 +02:00
parent 249902ab31
commit 591ded8309
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 5 additions and 1 deletions

View File

@ -136,7 +136,7 @@ function Runner:_start()
wait_step = s.step
else
s.task = self:queue(plugin, step)
plugin._.working = not not s.task
plugin._.working = true
active = active + 1
end
end

View File

@ -146,7 +146,11 @@ 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