1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Engine-owned selection state (see `docs/architecture.md` "Selection").
//!
//! Anchors are stored in **absolute buffer coordinates** — a line index into the
//! concatenated `[scrollback ++ screen]` stream, counted from the oldest line.
//! This coordinate is stable under a normal top-anchored scroll (the evicted
//! line entering scrollback grows `scrollback.len()` by exactly the screen
//! shift, so existing content keeps its absolute index); the only places it
//! moves are cap eviction, in-screen region/RI scrolls, and reflow — each
//! handled explicitly by `Term`. The cell-aware logic (text extraction, range
//! clipping) lives in `term.rs`, where the cells are.
/// What a selection covers.
/// Which half of a cell an anchor sits on — the left or right edge. Lets a drag
/// include or exclude the cell under the pointer (mouse precision).
/// One highlighted run on a single **viewport** row: columns `left..=right`
/// (both inclusive). `selection_range` returns one per visible row the selection
/// touches — the renderer paints these. Off-screen rows are not emitted.
/// A point in absolute buffer coordinates: `line` indexes `[scrollback ++ screen]`
/// from the oldest line, `col` is the column.
pub
/// A selection endpoint: a buffer point plus which side of the cell it touches.
pub
/// The live selection: where the drag began (`anchor`) and where it currently
/// reaches (`focus`). Either may be the earlier point — `ordered` sorts them.
pub