Skip to main content

Module ask

Module ask 

Source
Expand description

A question over the screen: a line of text and the answers to it, one in focus (“Keep these changes? Keep · Discard · Back”), or a yes/no answered by Confirm and Cancel alone, its keys named under it (Ask::yes_no).

The screen holds an Ask while the question is open and hands it each action (Ask::handle): the cursor moves between the answers, Confirm gives the focused one and Cancel the answer it stands for, if any. What the question shows is Ask::view, plain data, and glyph::paint draws that view in a box over whatever is under it. A farming game’s “Sell all 12 turnips?” and a platformer’s “Restart the level?” are the same widget.

Re-exports§

pub use view::AnswerView;
pub use view::AskView;

Modules§

glyph
The glyph look of an Ask: paints an AskView in a double-bordered box in the middle of the buffer, over whatever is under it. The question is on the first line; under it, the answers in a line with the one in focus as a highlight bar, or the dim line naming the keys that answer. Everything about the look lives here; nothing here decides what the question shows. Another look is another paint of the same view.
view
What a question shows, as plain data: no cells, glyphs, colours or positions. Ask::view builds it and a skin paints it (super::glyph::paint today).

Structs§

Ask
A question and its answers, each a T the screen acts on.