Skip to main content

Module nav

Module nav 

Source
Expand description

The navigator’s tree, flattened into the rows a panel draws.

NavTree is what the document holds; what a panel puts on screen is a flat list, because three things have to happen to a nested tree before it is legible in a narrow panel and all three change which rows exist rather than how they look:

  1. Focus re-roots. The tree is redrawn from one node, so indentation resets and a name’s width does not depend on how deep it really is.
  2. The filter flattens. Matches become a flat list carrying their ancestry as text; ancestors are never rows of their own, since three matches would otherwise become fifteen rows of context. The filter reads the whole document, crossing the focus boundary.
  3. Reveal opens ancestors. Selecting geometry opens every ancestor of the block, and gives up a focus that would hide it.

Which rows those are is one answer, here, so two front ends browsing one document browse the same tree. What is not here is the state the answer is taken against — the expand set, the focus, the filter text — which is each shell’s own (shell-on-kernel D7).

Structs§

Index
The child→parent links of the whole reachable tree and, while searching, the blocks whose own label matches.
Row
One row of the flattened tree.
Walk 🔒
One step of the depth-first flatten: where it is, and everything constant across the whole walk.

Enums§

Filtered
Whether the tree is showing a filtered subset.

Functions§

branch_rows
Every block the tree hangs a disclosure triangle on, read off the rows themselves with every branch expanded — the navigator’s own answer, for the test that holds it to the canvas’s double borders and the PDF’s pages. The tree root is never a row of its own, so it is never here.
label_of
A row’s label, falling back to the block’s id when the block has left the tree so a breadcrumb never shows a blank segment.
mark_last_children 🔒
Which rows end their parent’s run of children: the last row at a given depth before the tree steps back out of it. A directory tree’s guide down from a parent stops at its last child rather than running on past the family, and the flat row list is enough to say which row that is.
matches_filter
Case-insensitive substring match against the block’s name/type label; an empty or whitespace filter matches all.
rooted_at
The scope the tree hangs from: the focused block, or the tree’s own root when nothing is focused or the focused block has since left the document.
shortened
segments joined into a path that fits room, dropped from the LEFT: the immediate parent is what tells two matches apart, so it is the end that survives. measure is the caller’s own text measurement, so what is dropped depends on the font actually painting it.