justerm_core/logical.rs
1//! Viewport logical lines (#113, ADR-0017): soft-wrap-joined text plus a
2//! per-char map back to viewport cells. This is the buffer-wide *mechanism* a
3//! frame-mode consumer needs for URL detection — the regex and `new URL()`
4//! validation stay consumer-side (policy). It also serves the a11y screen-reader
5//! mirror (#119). The cell-aware assembly lives in `term.rs`, where the cells
6//! are; this module is just the returned shape.
7
8/// One soft-wrap-joined logical line touching the viewport.
9#[derive(Clone, PartialEq, Eq, Debug)]
10pub struct LogicalLine {
11 /// The line text: wrap-joined across soft-wrapped rows, wide-char spacers
12 /// skipped, trailing blanks trimmed (matches xterm `translateToString(true)`).
13 pub text: String,
14 /// Per `text` char, the viewport cell `(row, col)` it came from. A `row`
15 /// outside `0..rows` is off-screen wrapped context (a line that wraps in from
16 /// above the top / out past the bottom) — present so a URL spanning the edge
17 /// still matches; the consumer highlights only the in-range cells.
18 pub cells: Vec<(i32, usize)>,
19}