Skip to main content

Module event

Module event 

Source
Available on crate feature term only.
Expand description

Asynchronous terminal events.

EventStream uses the active Compio runtime. Linux uses Compio’s managed multishot read operation. Other Unix systems use the Compio polling driver when stdin is a terminal. If stdin is redirected, they use Compio timers with nonblocking rustix reads from /dev/tty. Windows uses a Compio event wait and ReadConsoleInputW. No backend starts a helper thread.

Event values and event-control commands are re-exported from Crossterm. Code that already matches on Event, KeyCode, or MouseEvent can use the same values with this stream.

Terminal input is normally line buffered. Enable raw mode before reading individual key events. Mouse, focus, bracketed-paste, and enhanced keyboard events also require their corresponding Crossterm command to be enabled.

Structs§

DisableBracketedPastebracketed-paste
A command that disables bracketed paste mode.
DisableFocusChange
A command that disables focus event emission.
DisableMouseCapture
A command that disables mouse event capturing.
EnableBracketedPastebracketed-paste
A command that enables bracketed paste mode.
EnableFocusChange
A command that enables focus event emission.
EnableMouseCaptureevents
A command that enables mouse event capturing.
EventStream
A local asynchronous stream of terminal events.
KeyEvent
Represents a key event.
KeyEventState
Represents extra state about the key event.
KeyModifiers
Represents key modifiers (shift, control, alt, etc.).
KeyboardEnhancementFlags
Represents special flags that tell compatible terminals to add extra information to keyboard events.
MouseEvent
Represents a mouse event.
PopKeyboardEnhancementFlags
A command that disables extra kinds of keyboard events.
PushKeyboardEnhancementFlags
A command that enables the kitty keyboard protocol, which adds extra information to keyboard events and removes ambiguity for modifier keys.

Enums§

Event
Represents an event.
KeyCode
Represents a key.
KeyEventKind
Represents a keyboard event kind.
MediaKeyCode
Represents a media key (as part of KeyCode::Media).
ModifierKeyCode
Represents a modifier key (as part of KeyCode::Modifier).
MouseButton
Represents a mouse button.
MouseEventKind
A mouse event kind.