Skip to main content

Module pointer

Module pointer 

Source
Expand description

The mouse: what a click, a drag or a turn of the wheel means where it lands.

Keys stay the interface and the mouse is a shortcut to them. The wheel presses the arrows of whatever has the keys, a click on a footer key presses it, a click on a form’s row focuses it and presses Space, a click on a tab steps the tab bar to it, and a click on the table or the home list moves the cursor there, a double click then pressing Enter. A click on a chart’s plot puts the crosshair there, as x and the arrows would. Dragging a header moves its column as H / L do, and dragging the gap after it sets its width as < / > do; a double click on a header sorts by it as [ / ] do, and on the gap after it fits it as = does. A right click on a cell opens a menu of the keys that act on it. Nothing here changes what a key does.

A pointer is aimed at what is on screen when it is used, so mouse input is never held for later the way typed keys are: where a typed key would wait, a mouse event is dropped (see crate::event_pump::EventPump::terminal_mouse).

What a click can land on is recorded while a frame is drawn (record): the widget that lays a row or a tab out says where it put it, so nothing computes the layout a second time.

Structs§

Clicked
A field a click focused: its kind, and whether the click acts on it as well (a list row’s first click only focuses it: Form::list_row).
EnableMouse
Ask the terminal for presses, releases, motion while a button is down (a drag) and the wheel, SGR-encoded so a wide screen’s far columns report right. Not crossterm’s EnableMouseCapture, which also asks for every motion with no button down: a stream of events the app would only throw away. Undone by DisableMouseCapture, which turns off every mode.
FieldId
A form’s field as drawn: the form, by its type, and the field, by name. Kept as text so a frame’s regions need not know every form’s field type.
Pointing
What the last frame drew where, the last click, and a drag in progress.

Enums§

Drag
A drag in progress, from a press on the table’s header.
Hit
What a region of the frame is, for a click.
Pointer
What a mouse event comes to.
Target
Where a click or the wheel moves the cursor.

Constants§

DOUBLE_CLICK
Two clicks on one cell this close together are a double click.
WHEEL_ROWS
Rows a notch of the wheel moves.

Functions§

act_key
The key a click presses on a field it focused: Space acts on it (toggles, steps, opens, presses); a right click steps a choice back, as ← does, and only focuses anything else. A text field only takes focus.
capture
Take the mouse from the terminal when on (display.mouse, --mouse); off, the terminal keeps it, and selecting text works as it does anywhere.
chip_key
The key a chip’s label names, when it names one key: Enter, ^O, q, F1.
record
Say what a region of the frame being drawn is. Later regions lie on top.
record_field
Say that rect is form T’s row for field.
record_spans
Record a line’s spans that a click picks among: each (span, hit) names a span of line, drawn left-aligned from area.x on area.y. Their places are summed from the spans drawn, so they agree with the line on screen.
wanted
The mouse events the app acts on: a left press, its drag and release, a right press, and the wheel. Motion with no button down and the middle button are left alone.