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
Marking a file reviewed while filtering unreviewed files jumps the tree scroll position #258
After the unreviewed-files filter added in #257 is enabled with F, pressing Space to mark the selected file as reviewed removes it from the filtered tree and advances the selection, but also scrolls the tree so the next selected file is on the last visible row.
This is especially disruptive after skipping many files and starting review from the middle or bottom of the tree. Even when the reviewed file was at the top or middle of the viewport, each review action jumps the next file to the bottom, making it harder to retain visual context.
Steps to reproduce
Open a diff containing enough files for the file tree to scroll.
Press F to show only unreviewed files.
Skip several files so the selection is somewhere in the middle or lower part of the tree.
Press Space to mark the selected file as reviewed.
Actual behavior
The reviewed file disappears and the tree scrolls, placing the next selected file on the last visible row.
How does this solve it?
Preserve the selected row’s approximate viewport position when the reviewed file is removed from the filtered tree. The next selected file should stay where the reviewed file was, unless scrolling is actually required to keep it visible. This removes the unnecessary jump while retaining the automatic advancement introduced in #257.
root cause is selectAfterRebuild (app/ui/sidepane/filetree.go:440) zeroing ft.offset on every filter refresh. The next render's ensureVisible (app/ui/sidepane/sidepane.go:79) then sees the advanced cursor below the window and clamps offset = cursor - height + 1, which pins the next file to the last row. Preserving the offset instead of resetting to 0, and letting ensureVisible scroll only when the selection would otherwise be hidden, should cover it.
Activity
mishamsk commentedon Jul 12, 2026
@melonamin @umputun awesome feature that I asked for. let me know if you'd prefer me fixing this
umputun commentedon Jul 13, 2026
yes pls, go for it.
root cause is
selectAfterRebuild(app/ui/sidepane/filetree.go:440) zeroingft.offseton every filter refresh. The next render'sensureVisible(app/ui/sidepane/sidepane.go:79) then sees the advanced cursor below the window and clampsoffset = cursor - height + 1, which pins the next file to the last row. Preserving the offset instead of resetting to 0, and letting ensureVisible scroll only when the selection would otherwise be hidden, should cover it.fix(ui): preserve unreviewed tree scroll (umputun#259)