diff --git a/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt index b0e8d038..b7691593 100644 --- a/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt +++ b/richeditor-compose/src/commonMain/kotlin/com/mohamedrejeb/richeditor/model/RichTextState.kt @@ -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(