ratatui_toolkit/widgets/markdown_widget/state/selection_state/mod.rs
1//! Selection state for markdown widget text selection and copy.
2
3pub mod constructors;
4pub mod methods;
5
6pub use constructors::*;
7pub use methods::*;
8
9use crate::widgets::markdown_widget::foundation::types::SelectionPos;
10
11/// Selection state for markdown widget.
12///
13/// Tracks whether selection mode is active and the selection bounds.
14#[derive(Debug, Clone, Default)]
15pub struct SelectionState {
16 /// Whether selection mode is active.
17 pub active: bool,
18 /// Selection anchor (start point).
19 pub anchor: Option<SelectionPos>,
20 /// Current cursor/end position.
21 pub cursor: Option<SelectionPos>,
22 /// Cached rendered lines for stable selection.
23 pub frozen_lines: Option<Vec<ratatui::text::Line<'static>>>,
24 /// Width when lines were frozen.
25 pub frozen_width: usize,
26 /// Last copied text (for showing toast notification).
27 pub last_copied_text: Option<String>,
28}