Version
com.mohamedrejeb.richeditor:richeditor-compose 1.0.0-rc14 (Android)
Describe the bug
Selecting text by touch-drag (press, then drag to extend the selection — without first long-pressing) is interrupted mid-gesture: the selection stops extending while the finger is still down, and you have to lift and start again. It's worst crossing a word boundary or line break.
Long-press-then-drag (dragging the selection handles after a long-press) is smooth — only the direct press-drag-to-select path is affected.
Root cause (from reading the rc14 source)
On every selection change during a drag, RichTextState.onTextFieldValueChange → updateTextFieldValue takes the maskAffected branch (the drag selection is non-collapsed) and calls updateAnnotatedString(...), which rebuilds annotatedString and reassigns textFieldValue to a new instance (newTextFieldValue.copy(...)) on every tick — this is the selection-highlight background mask (code comments reference #635).
Hypothesis for the interruption: the underlying BasicTextField receives an externally-updated value on every drag frame, which resets its in-progress selection gesture.
This also seems consistent with the long-press difference — the multi-paragraph workaround (adjustSelection, gated on lastPressPosition, which is cleared ~300 ms after the press) is active only in the first ~300 ms of a press, the window a quick press-drag falls in.
To Reproduce
- Show a
RichTextEditor/OutlinedRichTextEditor with a few lines of text (multi-paragraph makes it worse).
- On a touch device, press on a word and drag to extend the selection — do not long-press first.
- The selection stops extending partway through while the finger keeps moving; you must release and retry.
Expected behavior
Press-drag selection extends continuously with the finger, like a plain Compose BasicTextField.
Environment
- richeditor-compose: 1.0.0-rc14
- Jetpack Compose BOM: 2026.03.01
- Platform: Android (touch)
Version
com.mohamedrejeb.richeditor:richeditor-compose1.0.0-rc14 (Android)Describe the bug
Selecting text by touch-drag (press, then drag to extend the selection — without first long-pressing) is interrupted mid-gesture: the selection stops extending while the finger is still down, and you have to lift and start again. It's worst crossing a word boundary or line break.
Long-press-then-drag (dragging the selection handles after a long-press) is smooth — only the direct press-drag-to-select path is affected.
Root cause (from reading the rc14 source)
On every selection change during a drag,
RichTextState.onTextFieldValueChange→updateTextFieldValuetakes themaskAffectedbranch (the drag selection is non-collapsed) and callsupdateAnnotatedString(...), which rebuildsannotatedStringand reassignstextFieldValueto a new instance (newTextFieldValue.copy(...)) on every tick — this is the selection-highlight background mask (code comments reference #635).Hypothesis for the interruption: the underlying
BasicTextFieldreceives an externally-updatedvalueon every drag frame, which resets its in-progress selection gesture.This also seems consistent with the long-press difference — the multi-paragraph workaround (
adjustSelection, gated onlastPressPosition, which is cleared ~300 ms after the press) is active only in the first ~300 ms of a press, the window a quick press-drag falls in.To Reproduce
RichTextEditor/OutlinedRichTextEditorwith a few lines of text (multi-paragraph makes it worse).Expected behavior
Press-drag selection extends continuously with the finger, like a plain Compose
BasicTextField.Environment