Expand description
The live view’s whole state: what is open, what is marked, and where the cursor is.
Nothing here touches the terminal or the filesystem. Every rule the front end has is a
function of a Tree and some keystrokes, which is what makes them assertable one at a
time — “marking a collapsed row marks everything under it” is a test rather than a
screenshot.
§The cursor is anchored to a path, never to a row
pua anchors its cursor to (pid, start_time) because processes vanish under a live cursor.
Here the equivalent event is deletion: rows disappear as the deleter finishes each
target, and a cursor holding a row index would slide onto whatever fell into that
position — which, under a held key, deletes something nobody chose.
So a keystroke or an arrival re-walks the tree and puts the cursor back on the path it
was on. If that path is gone the chain of its ancestors is tried in turn, which lands on the
nearest surviving directory rather than on the other side of the screen — usually the
project whose node_modules was just deleted, and at worst the scan root, which is the last
rung of the chain and still somewhere the reader was. If none of them is on screen at all —
which a filter can do, where a deletion cannot — the cursor is deselected, visibly, so
the next arrow key picks a row deliberately.
There is no index fallback, and that is the point rather than an omission: clamping the old index is the same mis-selection one step removed. The two outcomes above are both statements about a directory; row 0 is a statement about a position, and after a deletion the two name different things.
§Marks are subtree roots, not a set of rows
Marking a collapsed row has to mark everything beneath it — that is the whole reason the rollup is worth having — and the tree it covers can still be growing while the scan runs. Storing the covered claims would mean a set of 8,660 ids for one keystroke and a set that silently missed whatever arrived afterwards. So a mark is the root of a marked subtree, a row is marked when it or any ancestor is one, and a row is partial when a mark sits somewhere below it. A claim that streams in under a marked directory is marked on arrival, which is what a reader who marked that directory asked for.
Unmarking one row out of a marked subtree is the interesting case, and it is why the marks are not just a set: the ancestor’s mark is pushed down, replaced by marks on everything beside the path to the row being spared. “Mark all, then keep this one” is a real workflow — npkill’s select-all exists for the first half of it — and the alternative is telling a reader to clear forty marks and start again.
§What the footer says is transient, and has to be able to stop being said
A Notice is a report about something that has already happened, drawn in permanent
furniture: the footer, which otherwise carries the keys. So a report with no way out is a
stale claim sitting on the one line that tells a reader what they can do — and the older it
gets the less of the tree it still describes. See Notice for how long one lasts and why.
§The clock is handed in, like everything else
This file animates (super::moving) and still has no terminal and no filesystem in it,
because time arrives the same way a keystroke does: View::animate is given the instant
and everything else reads it off View. So “a removed row empties for a third of a
second and then collapses away” is an assertion with three advances in it rather than a
test that sleeps, and the drain’s consequences — a row that can no longer be marked,
deleted a second time, or counted into a batch — are assertions too.
The one thing on screen that is deliberately not on that clock is the notice. Everything
the clock drives is a number moving towards a fact the reader can still go and check; a
report of what was destroyed is the one thing they cannot, so its lifetime is a reader’s
action instead. See Notice.
Structs§
- Entry
- One line of the batch a confirmation lists.
- Notice
- One sentence for the footer, and how long it stays there.
- Pending
- The question the delete key asks, and everything it is holding while it asks.
- Planned
- One directory a resolved plan is going to remove, as the confirmation needs it.
- Prompt
- The filter prompt, while it is up.
- Removing
- How far through its batch a running removal is.
- Roll
- What a row’s subtree is worth: the three numbers every total on the screen is made of.
- Row
- One line of the tree, once the collapsed subtrees have been left out.
- View
- The live view.
Enums§
- Answer
- The two answers a confirmation has.
- Effect
- What the event loop has to do about a keystroke, once the view has done its part.
- Mark
- How much of a row’s subtree is marked.
Functions§
- plural
1 directory,4 directories.