Skip to main content

Module event_pump

Module event_pump 

Source
Expand description

The main loop, minus the terminal.

run() sets up the terminal and hands EventPump::run a way to draw. Keys arrive on the same channel as worker results (crate::app::terminal_input), so the loop sleeps until either arrives or a deadline passes (Pacer). Keys typed while busy are held in order and replayed one per iteration once idle, through the path a fresh key takes; a replayed key’s follow-ups drain before the next is offered, so a queued Enter finishes its search first.

Structs§

EventPump
Owns the app, its channel and the keys held while it was busy.
Pacer
When the run loop draws and how long it may sleep: never on a fixed tick, only until the spinner’s next frame, an owed progress frame, or the app’s own deadline (a flash expiring).

Enums§

Drained
What a pass over the channel found.
Ended
How the run loop ended.

Constants§

MAX_HELD_KEYS
Keys held while busy. Beyond this the newest is dropped and the user told: the oldest may be the / that makes the rest a query rather than hotkeys.
PROGRESS_FRAME
The least time between frames drawn for progress reports alone; keys and results draw at once.
SPINNER_FRAME
How often a spinner turns while the user waits: about 30 frames a second.
SPINNER_IDLE_FRAME
How often it turns for unwaited work (a count, a read-ahead): ten frames a second, redrawing a third as often.