Skip to content

Commit

Permalink
feat(ui): keep cursor position when rendering view
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 26, 2024
1 parent 249902a commit 591ded8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua/lazy/manage/runner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lua/lazy/view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 591ded8

Please sign in to comment.