Skip to main content

Module tree

Module tree 

Source
Expand description

The shared sidebar row vocabulary (TreeRow/TreeNode) and pure directory-trie flattening, used by the diff sidebar and the status sections. visible_rows turns a file list (repo-relative paths, in input order) into visible rows honoring fold state: directories before files at each level, input order preserved within a kind, folded directories hiding their subtree. It only ever emits Dir and File rows; Section rows are composed by the diff sidebar’s review layout on top of the same vocabulary. No rendering and no app state, so the navigation math is fully unit-testable.

Structs§

TreeRow
A flattened tree row: a node and its indentation depth (0 at the root).

Enums§

Bucket
What a section header stands for: review progress (still to review, already viewed) in the review layout, or what the files are in the kinds layout.
TreeNode
One node in a flattened tree row: a directory (carrying its full path as the fold key, and the last path segment as its display name), a file (carrying its index into the source path slice, and its basename), or a review-mode bucket header. Sections are composed by the diff sidebar’s review layout; the trie flattening below never produces them.

Functions§

flat_rows
The flat-list rows for paths: one File row per entry, depth 0, full path as its name, index into the source slice. A degenerate tree (no Dir rows) so callers can drive the same cursor and file-navigation logic over the flat list and the tree layout alike.
visible_rows
Build the flattened, fold-respecting visible rows for paths (each a file’s repo-relative path, in input order). folded holds folded directory paths. Directories are sorted before files at each level; entries keep input order within a kind. A directory not in folded is expanded.
visible_rows_promoting
visible_rows, with the files promote accepts (by their index into paths) listed first inside each directory. The diff sidebar promotes the files already viewed, so a directory reads as what is done over what is left.