Skip to main content

Module terminal_input

Module terminal_input 

Source
Expand description

The one reader of the terminal.

The run loop waits on a single channel: worker results, continuations and keys all wake it, so nothing waits out a poll interval for news that has already arrived. Terminal events get onto that channel through this thread, which is the only thing that reads them — through Crossterm’s own EventStream, so Crossterm’s parser and its reader lock are never raced by a second reader.

The stream is polled by hand on a dedicated thread rather than on the shared Tokio runtime: a runtime busy with blocking work must not delay a key. A parked thread costs nothing while the terminal is quiet, and stopping it is deterministic, which matters to the Python binding: a reader left behind would read the REPL’s input after the TUI is gone.

Structs§

TerminalInput
The running reader. Stopped (and joined) on drop.