Skip to main content

Module render

Module render 

Source
Expand description

Drawing one frame, and reading back where it put things.

Everything here reads the View and writes cells. The two things it writes back are measurements — how many rows the tree pane got, and how far the help page can scroll — and a Placed, which is where the frame put everything a pointer can aim at.

§What a row has to say

Four things, in the order a reader needs them: how much of it is marked, where it is, what it is worth, and when it was last touched. The last two are npkill’s columns and the first is what npkill’s flat list cannot have.

The size column has a fifth state the other tools never needed: unpriced. A claim is recorded without being measured unless somebody asks, so 0 B and “nobody has looked” are different facts about a row, and a dash is what keeps them apart. It has a sixth as well, which is the one that moves: a claim a pricing thread is inside at this instant draws a shimmer through that dash rather than the dash. The pool is bounded, so however many rows shimmer is however many threads are working, and that is a number worth being able to see.

§The layout is stated once and read twice

hit resolves a cell to a Spot, and it does that against the rectangles draw actually produced rather than against a second description of them. Being one cell out here is not a cosmetic bug: it is a press that opens, marks or prices a row nobody aimed at. So the tree’s columns come out of one [columns] call that both lays the table out and answers the hit test, and a row’s own cells — the mark box, the indent, the expander — are spelled by the constants [name] draws them with.

§Nothing here decides what moves, only how it looks

Every animated value is asked for by name — View::drawn, View::freshness, View::is_pricing — and the view has already advanced them all once for this frame. So this file has no clock in it and no state between frames, and the drawing stays a pure function of the view, which is what keeps it assertable against a TestBackend one property at a time.

Structs§

Columns
Where the tree’s columns went, laid out once for the table and for the hit test.
Placed
Where the last frame put everything a pointer can aim at.

Enums§

Spot
What is under the pointer, on the frame that was drawn.
Zone
Which part of a row the pointer is on.

Functions§

draw
Draws the whole frame, and says where it put what a pointer can aim at.
hit
What the pointer is over, resolved against the frame that was drawn.