Skip to content

Commit

Permalink
Allow setting text range when setting text to RichTextState
Browse files Browse the repository at this point in the history
  • Loading branch information
Sermilion committed Jan 7, 2025
1 parent 2846548 commit 0c4bc63
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3086,11 +3086,14 @@ public class RichTextState internal constructor(
*
* @param text The text to update the [RichTextState] with.
*/
public fun setText(text: String): RichTextState {
public fun setText(
text: String,
selection: TextRange = TextRange(text.length),
): RichTextState {
val textFieldValue =
TextFieldValue(
text = text,
selection = TextRange(text.length),
selection = selection,
)

onTextFieldValueChange(
Expand Down

0 comments on commit 0c4bc63

Please sign in to comment.