mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-06 14:06:32 -04:00
Cycling pagers re-renders the diff into the main view. Until now that either lost the scroll position outright — an entry with its own externalDiffCommand changes the actual git command, so the re-render reset the view to the top — or kept it only by raw line number, which a plain pager swap got for free because the git command was unchanged. Raw line number is the wrong anchor: two pagers can structure the same diff very differently (side-by-side vs inline), so the same screen line means something different afterwards. Reuse the identity-based restore (PreserveDiffPositionOnRerender, already driving the -U context-size consumer) to re-anchor on the same patch line instead. That both keeps the position meaningful when the structure changes and covers the externalDiffCommand case the line-number approach couldn't. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>