Function extend_span_drag
pub fn extend_span_drag<T>(
anchor_lo: T,
anchor_hi: T,
raw: T,
unit_lo: T,
unit_hi: T,
) -> (T, T)Expand description
Word/line-granularity drag extension — the shared rule behind
double-click-then-drag in TextInput and the reader.
After a double-/triple-click snaps the anchor to a whole unit
(anchor_lo, anchor_hi) (lo <= hi), a continuing drag must keep that
unit inside the selection and grow by whole units. Given the boundary
span (unit_lo, unit_hi) the pointer now sits in and its own position
raw (to decide which side of the anchor it’s on), returns the
(anchor, cursor) the selection should adopt.
T is whatever a selector indexes by — a byte offset (TextInput) or a
(block, char) document position (the reader) — so both share one rule.