Repository navigation
feat(ui): hide files already marked reviewed with H - #596
Merged
agavra merged 5 commits intoAug 18, 2026
Merged
Conversation
patrickjmccauley
marked this pull request as ready for review
August 12, 2026 18:50
agavra
reviewed
Aug 13, 2026
agavra
left a comment
Owner
There was a problem hiding this comment.
this is a great addition @patrickjmccauley thank you! left one comment inline
| (KeyCode::Char('I'), _) => Action::FileTreeClearInclude, | ||
| (KeyCode::Char('E'), _) => Action::FileTreeClearExclude, | ||
| (KeyCode::Char('/'), _) => Action::FileTreeSearch, | ||
| (KeyCode::Char('H'), _) => Action::ToggleShowReviewed, |
Owner
There was a problem hiding this comment.
I like this feature but I think we should keep close to vim keybindings, this would reserve H for moving the cursor to the first character in a line (I guess that doesn't really make sense since we can't edit, but I still prefer not introducing new single-stroke values).
I'd prefer keeping just a <leader> (:) command for now.
Contributor
Author
There was a problem hiding this comment.
that makes total sense - apologies, I'm still ramping up on the vim keybinds. will refactor to the leader command, then re-request
probably too niche for top level readme
Owner
|
failing test is unrelated, i'll merge and fix that one on main |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This is a bit like the Github native review screen's filter allowing users to hide already-viewed files from the UI/file explorer sidebar.
On a large review, files already marked reviewed with
rkeep their row in the file tree and their header row in the diff. The body collapses, but the rows stay — so the list never shrinks and the remaining work is buried in it. This adds a way to see only what is left.What this adds
H(file tree):set noreviewed/:set reviewed/:set reviewed!:reviewed:wrapshow_reviewed = falsetrue)Hrather thanh, becauseh/lpan the tree horizontally — that is how long nested paths are read in a narrow panel, and takinghwould have left panning one-way.Hwas unbound everywhere. It is file-tree only, so the diff pane leaves it alone;:set reviewed!is the way to toggle from there.The commands mirror
:set commits/:set nocommits/:set commits!rather than inventing a shape, since that is the same kind of toggle — which files appear in the tree and the diff.While hiding,
rbecomes a burn-down loop: marking the file you are reading moves you to the next unreviewed file, wrapping at the end, and parks at the overview when nothing is left.Implementation
file_passes_filter()was already the single predicate consulted bybuild_visible_items,rebuild_annotations,file_render_height/effective_file_height,hunk_positions, and both diff renderers, so the tree, the diff pane,{/}file navigation and[/]hunk navigation all follow from one gate.The one structural change is splitting that predicate in two, because "which files are displayed" and "how many files am I reviewing" stop being the same question:
file_matches_patterns()—i/eonly. The review population: what the tree title'sreviewed/totalfraction counts, and what/search walks.file_passes_filter()— that plus the reviewed toggle. What is actually on screen.Without the split, the title collapses to
0/9exactly when progress matters most. It stays3/12, and the tree's bottom border carries areviewed hiddencue beside the existingi:/e:chips.Behaviour worth a second opinion
+/-totals drop reviewed files' lines while hiding.diff_stat()is gated byfile_passes_filter, so this is automatic, and it matches whati/ealready do. It reads as "diff left to review", but it does mean the header and the tree title deliberately count different populations.R-marked is not hidden. Only the file-levelrflag hides. Partly to avoid surprise, partly becauseis_hunk_reviewedhashes every hunk in the file and has an explicit guard against speculative calls.rcan no longer reach it.H/:set reviewedis the only way back, so the status messages name it.i/e: a filter is a view, not an edit. The flag survives:eand resets on restart unless configured.A bug caught while implementing
main.rsapplies config afterApp::buildhas already built the annotations.total_lines()recomputes from the filter butline_annotations— what the diff renderer and the cursor read — does not, so setting the flag directly left them disagreeing (7 annotation rows against 6 real ones) andshow_reviewed = falserendered a misaligned diff. Henceinit_show_reviewed(), which re-derives, rather than a bare field assignment. Guarded byshould_leave_no_stale_annotations_when_the_startup_default_hides_reviewed_files.FileTreeFilteralso loses its derivedDefault—show_revieweddefaults to true, and a derivedbooldefault would have silently booted with reviewed files hidden.Tests
38 tests in the filter suite, covering: hidden from the tree, from the diff render height, and from hunk-position alignment; the progress fraction holding over the whole population and still respecting
i/e;/search skipping hidden files; burn-down advance, wrap, and exhaustion; hunk-reviewed files staying visible; and the startup-default rebuild.The tree's
randHare covered through the realhandle_file_list_actionpath rather than only viaAppmethods, so key routing is part of the guard. Three new render tests drive the actualui::renderagainst aTestBackendand assert the on-screen footer cue and title. Plus keybinding tests (Hmaps in the tree and not in the diff;hstill scrolls), command-parse tests for all four forms, and config-parse tests.Docs
README.md,src/ui/help_popup.rs, the file-tree hint insrc/ui/status_bar.rs,docs/KEYBINDINGS.md(key table,:command table, and a Filtering subsection),docs/CONFIG.md(Options row + full example), and theFileTreeFiltersection ofAGENTS.md.AGENTS.md's doc-update table had no row fordocs/KEYBINDINGS.mdorsrc/ui/status_bar.rs, despite both tracking every keybinding — added, since I only found them by grepping.