Expand description
Selection: hit-testing, the selection range, and text extraction.
Selection is a document position pair, not a pixel pair. A
Caret names (message, source-within-message, byte offset), so
the selection survives everything that moves pixels around — a
resize re-wraps, a zoom rescales, an image finishes decoding and
grows its row, a history batch prepends above. xtext stored
mark_start / mark_end as byte offsets on each textentry plus
select_start_x/y in widget coordinates, which is why its selection
behaves oddly across a resize mid-drag.
The engine deliberately owns none of the interaction — no notion of button state, drag, or double-click. It answers three questions and the widget does the rest:
- where in the document is this pixel? ([
ChatBuffer::hit_test]) - what does the region between two carets look like? (
Selection) - what text does that region contain? ([
ChatBuffer::selected_text])
Structs§
Enums§
- RowSelection
- How far a selection extends within one row.
Functions§
- source_
rank - Visual order of a row’s texts.