Skip to main content

Module render

Module render 

Source
Expand description

Drawing the setup wizard.

One draw per frame, laid out as a fixed header (step breadcrumb), a body that varies per step, and a footer (message line plus key hints), with an optional help overlay on top. Every function takes &Wizard and produces widgets - no state changes here, so a render can never be the reason something moved.

Every step builds a Screen: flat lines, plus the line each selectable row starts on. That shape is what makes the wizard survive a small window. The screens used to be Lists of pre-sized items and assumed the terminal was tall enough, so the tuning screen’s thirteen fields simply stopped at whatever row ran out of pane, with nothing on screen to say more existed. Wrapping happens here too, in wrap_line, for the same reason: the number of rows a screen occupies is only knowable once its text is wrapped, and without that number there is nothing to scroll against.

Functions§

draw
Draw one frame.
picker_row_at
Which option a click in the chooser landed on, as an index into the filtered list. Shares picker_layout with the drawing, so a click cannot resolve against rows that were not on screen.
row_at
Which selectable row, if any, sits under a point in the window.