[][src]Module phetch::menu

The Menu is a View representing a Gopher menu. It renders the colorful representation, manages the cursor and selection state, and responds to input like the UP and DOWN arrows or other key combinations.

The Menu doesn't draw or perform any actions on its own, instead it returns an Action to the UI representing its intent.

Structs

Line

Represents a line in a Gopher menu. Provides the actual text of the line, vs LineSpan which is just location data.

LineSpan

The LineSpan represents a single line's location in a Gopher menu. It only exists in the context of a Menu struct - its link field is its index in the Menu's links Vec, and start/end/text_end point to locations in Menu's raw Gopher response. You won't really interact with this directly, instead call menu.lines() get an iter over Line or menu.line(idx) to get a single Line.

LinesIter

Iterator over (dynamically created) Line structs.

Menu

The Menu holds our Gopher Lines, a list of links, and maintains both where the cursor is on screen and which lines need to be drawn on screen. While the main UI can be used to prompt the user for input, the Menu maintains its own input for the "quick navigation" feature using number entry and the "incremental search" (over menu links) feature using text entry.

Functions

parse

Parse gopher response into a Menu object.

parse_line

Parses a single line from a Gopher menu into a LineSpan struct.