fix(scroll): only reset count when needed

This commit is contained in:
Folke Lemaitre 2025-10-27 17:26:39 +01:00
parent 6a42a1d35f
commit 551d79f1c0
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -367,9 +367,11 @@ function M.check(win)
vim.cmd(("keepjumps normal! %s"):format(table.concat(commands, "")))
-- restore count (see #1024)
local cursor = vim.api.nvim_win_get_cursor(win)
vim.cmd(("keepjumps normal! %dzh"):format(count))
vim.api.nvim_win_set_cursor(win, cursor)
if vim.v.count ~= count then
local cursor = vim.api.nvim_win_get_cursor(win)
vim.cmd(("keepjumps normal! %dzh"):format(count))
vim.api.nvim_win_set_cursor(win, cursor)
end
state:update()
end)