You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Toggle compact diff view resets current position to the first line #271
changed the title [-]Toggle compact diff view resets current position to first line[/-][+]Toggle compact diff view resets current position to the first line[/+]on Jul 16, 2026
the fix keeps the cursor on the same line across the compact toggle and centers the view on it, so the hunk you were on stays visible with the cursor on it. It does not restore the exact scroll position though.
reproducing the same on-screen position isn't well-defined between the two views: compact collapses skipped regions into ⋯ N lines ⋯ dividers while full shows every line, so there's no 1:1 mapping, and hunks near the top or bottom clamp to the viewport edge instead of centering.
so it's "same hunk visible, cursor on the right line" rather than pixel-exact scroll restoration. In many cases the exact position can't be reproduced at all: if you're 20 rows down in full view but compact leaves only 5 rows above the hunk, there's nothing to fill the gap above, so the same screen position can't exist. That's a limit of the two views showing different content, not just a scope call.
Activity
[-]Toggle compact diff view resets current position to first line[/-][+]Toggle compact diff view resets current position to the first line[/+]umputun commentedon Jul 17, 2026
the fix keeps the cursor on the same line across the compact toggle and centers the view on it, so the hunk you were on stays visible with the cursor on it. It does not restore the exact scroll position though.
reproducing the same on-screen position isn't well-defined between the two views: compact collapses skipped regions into
⋯ N lines ⋯dividers while full shows every line, so there's no 1:1 mapping, and hunks near the top or bottom clamp to the viewport edge instead of centering.so it's "same hunk visible, cursor on the right line" rather than pixel-exact scroll restoration. In many cases the exact position can't be reproduced at all: if you're 20 rows down in full view but compact leaves only 5 rows above the hunk, there's nothing to fill the gap above, so the same screen position can't exist. That's a limit of the two views showing different content, not just a scope call.
feat: preserve cursor position across compact diff toggle
umputun commentedon Jul 17, 2026
fixed in #274 (adfa202)