r3bl_tui 0.7.7

TUI library to build modern apps inspired by React, Elm, with Flexbox, CSS, editor component, emoji support, and more
Documentation
// Copyright (c) 2025 R3BL LLC. Licensed under Apache License, Version 2.0.

//! OSC event types and definitions.

/// Represents parsed events from INCOMING OSC (Operating System Command) sequences.
///
/// These events are extracted when parsing OSC sequences received FROM applications
/// and represent the semantic meaning of those sequences. This is distinct from
/// `OscSequence` which is used to build OUTGOING OSC sequences to send TO the terminal.
///
/// ## Architecture Overview
///
/// The OSC processing pipeline has two distinct directions:
///
/// ### INCOMING (Application → Terminal Emulator)
/// 1. Application sends OSC sequences (e.g., `ESC]9;4;1;50ESC\\` for 50% progress)
/// 2. ANSI parser extracts these into `OscEvent` variants
/// 3. Terminal emulator acts on these events (updates progress bar, sets title, etc.)
///
/// ### OUTGOING (Terminal Emulator → Application)  
/// 1. Terminal emulator needs to send OSC sequences
/// 2. Creates `OscSequence` instances
/// 3. Formats them using `FastStringify`/`Display` traits
/// 4. Sends formatted sequences to the application
///
/// ## Common OSC Events
///
/// - **Progress Tracking**: Build tools like cargo send progress updates
/// - **Window Management**: Applications can set terminal title/tab names
/// - **Hyperlinks**: Modern terminals support clickable links in output
///
/// ## Usage Example
///
/// ```rust
/// use r3bl_tui::OscEvent;
///
/// // Example of matching OSC events:
/// let event = OscEvent::ProgressUpdate(75);
/// match event {
///     OscEvent::ProgressUpdate(pct) => {
///         println!("Progress: {}%", pct);
///     },
///     OscEvent::SetTitleAndTab(title) => {
///         println!("Title set to: {}", title);
///     },
///     _ => {
///         println!("Other OSC event");
///     }
/// }
/// ```
///
/// ## Relationship to Other Types
///
/// - **`OscSequence`**: Builds OUTGOING OSC sequences for terminal output
/// - **`DsrRequestFromPty`**: Represents DSR requests FROM PTY requiring responses
/// - **`CsiSequence`**: Builds OUTGOING CSI sequences for cursor/formatting control
#[derive(Debug, Clone, PartialEq)]
pub enum OscEvent {
    /// Set specific progress value 0-100% (OSC 9;4 state 1).
    ProgressUpdate(u8),
    /// Clear/remove progress indicator (OSC 9;4 state 0).
    ProgressCleared,
    /// Build error occurred (OSC 9;4 state 2).
    BuildError,
    /// Indeterminate progress - build is running but no
    /// specific progress (OSC 9;4 state 3).
    IndeterminateProgress,
    /// Hyperlink (OSC 8) with URI and display text.
    Hyperlink { uri: String, text: String },
    /// Set terminal window title and tab name (OSC 0).
    SetTitleAndTab(String),
}