Skip to main content

justerm_core/
event.rs

1//! Consumer event surface (#12): point-in-time notifications the engine
2//! accumulates while parsing, for the consumer to drain.
3//!
4//! Pull, not push — the engine queues events during `feed` and the consumer
5//! takes them with `drain_events`, mirroring the rest of the pull cadence
6//! (`damage` / `frame` / `reset_damage`). No callback is injected across the
7//! boundary, so the engine stays decoupled from the consumer's event loop
8//! (unlike alacritty's `EventListener`, whose push model would couple them).
9//!
10//! OSC 8 hyperlinks are deliberately absent — a hyperlink is per-cell state
11//! (which cells are links), not a point-in-time event, so it is modelled like
12//! graphemes in its own slice (#26), not here.
13
14/// A consumer-facing event emitted while parsing the VT stream.
15#[derive(Debug, Clone, PartialEq, Eq)]
16pub enum TermEvent {
17    /// The window/icon title was set (OSC 0 or OSC 2).
18    Title(String),
19    /// The terminal bell rang (BEL, `0x07`).
20    Bell,
21    /// The working directory was reported (OSC 7), e.g. `file://host/path`.
22    Cwd(String),
23    /// The app requested 80/132-column mode (DECCOLM `?3`). justerm is
24    /// dimension-free, so this is a *request* — the consumer may honor it by
25    /// calling `resize(cols, rows)`, or ignore it. `cols` is 80 or 132 (#82).
26    ColumnMode { cols: usize },
27    /// The app queried the light/dark color scheme (DSR `CSI ? 996 n`). justerm
28    /// is theme-agnostic, so the consumer (which knows the scheme) answers by
29    /// calling `Engine::report_color_scheme` (#85).
30    ColorSchemeQuery,
31}