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::ShellLifecycleEvent;
25pub use terminal::TerminalManager;
26pub use terminal::coprocess_env;
27
28// Re-export types from core that are part of our public API
29pub use par_term_emu_core_rust::terminal::{ClipboardEntry, ClipboardSlot, HyperlinkInfo};
30
31// Re-export Cell from config crate
32pub use par_term_config::Cell;
33
34/// A single search match in the terminal scrollback.
35#[derive(Clone, Debug, PartialEq, Eq)]
36pub struct SearchMatch {
37 /// Line index in scrollback (0 = oldest line)
38 pub line: usize,
39 /// Column position in the line (0-indexed)
40 pub column: usize,
41 /// Length of the match in characters
42 pub length: usize,
43}
44
45impl SearchMatch {
46 /// Create a new search match.
47 pub fn new(line: usize, column: usize, length: usize) -> Self {
48 Self {
49 line,
50 column,
51 length,
52 }
53 }
54}