Skip to main content

par_term_terminal/
lib.rs

1//! Terminal manager for par-term terminal emulator.
2//!
3//! This crate provides the `TerminalManager` which wraps the core PTY session
4//! and provides a high-level API for terminal operations including:
5//!
6//! - PTY I/O (read/write/paste)
7//! - Terminal lifecycle (spawn, resize, kill)
8//! - Shell integration (CWD, exit codes, command tracking)
9//! - Clipboard management
10//! - Inline graphics (Sixel, iTerm2, Kitty)
11//! - Search functionality
12//! - Scrollback metadata and prompt marks
13//! - Recording and screenshots
14//! - Coprocess management
15//! - tmux control mode
16
17pub mod scrollback_metadata;
18pub mod styled_content;
19pub mod terminal;
20
21// Re-export main types for convenience
22pub use scrollback_metadata::{CommandSnapshot, LineMetadata, ScrollbackMark, ScrollbackMetadata};
23pub use styled_content::{StyledSegment, extract_styled_segments, segments_to_plain_text};
24pub use terminal::TerminalManager;
25pub use terminal::coprocess_env;
26
27// Re-export types from core that are part of our public API
28pub use par_term_emu_core_rust::terminal::{ClipboardEntry, ClipboardSlot, HyperlinkInfo};
29
30// Re-export Cell from config crate
31pub use par_term_config::Cell;
32
33/// A single search match in the terminal scrollback.
34#[derive(Clone, Debug, PartialEq, Eq)]
35pub struct SearchMatch {
36    /// Line index in scrollback (0 = oldest line)
37    pub line: usize,
38    /// Column position in the line (0-indexed)
39    pub column: usize,
40    /// Length of the match in characters
41    pub length: usize,
42}
43
44impl SearchMatch {
45    /// Create a new search match.
46    pub fn new(line: usize, column: usize, length: usize) -> Self {
47        Self {
48            line,
49            column,
50            length,
51        }
52    }
53}