Expand description
W3.1: rope-backed text model components.
These components REPLACE the byte-offset TextInput.cursor model for the
W3 rewrite, but coexist with the existing TextContent / TextInput pair
so the bd23f51 surgical fix keeps working through the rewrite landing.
Component layering:
TextContent(existing) - rendered text for non-editable labels.TextBuffer(new) - rope-backed authoritative text for editable entities (<input>/<textarea>). Mirrored intoTextContentafter each edit so the existing renderer / binding path keeps working unchanged.TextCursor(new) - caret + selection anchor + affinity. Supplants the byte-offset fields onTextInput; the mirror system also writes the byte offset back intoTextInput.cursorfor legacy code paths (W3 stage; later waves remove the legacy fields).ImePreedit(new) - replacesImeState; carries the in-progress composition string plus the caret position inside it.
The From/Into impls follow the project-memory rule: convert between
types via trait impls, never bespoke convert_x_to_y helpers.
Structs§
- ImePreedit
- IME preedit (composition) state on a focused editable. Replaces the
pre-W3
ImeStatefor entities with aTextBuffer; the legacyImeStatestays for backwards compatibility with the oldTextInputpath until the W3 migration completes. - MarkId
- Stable identifier for a
TextMark. Marks survive edits. - Text
Buffer - Rope-backed authoritative text buffer for editable entities (W3.1).
- Text
Cursor - Caret + selection state on an editable entity (W3.1).
- Text
Editable - Marker: this entity is editable text (W3.1).
- Text
Mark - A point inside a
TextBufferthat survives edits (GTK’sGtkTextMark). Thetext_apply_editsmutator shifts marks during insert/delete according toSelf::bias. - TextPos
- Position inside a
TextBuffer; carries both byte (for slicing) and grapheme (for cursor display) axes. - Text
TagRange - A tagged byte range inside a
TextBuffer; survives edits via twoTextMarks at the endpoints.
Enums§
- Affinity
- Caret behaviour at line-wrap boundaries (Qt’s
Affinity). - Bias
- Insertion-at-mark bias (Qt’s
QTextCursor::MoveMode::KeepAnchorfor marks): when an insertion lands AT a mark’s byte position, should the mark stay before (Backward) or after (Forward) the new text? - TagKind
- Tag flavours carried by
TextTagRange. - Text
Buffer Kind - Single-line vs multi-line policy for
TextBuffer.