Skip to content

IllegalStateException: OffsetMapping.originalToTransformed returned invalid mapping #632

@muhammadawaisshan

Description

@muhammadawaisshan

I'm still getting getting this in the very latest version

java.lang.IllegalStateException: OffsetMapping.transformedToOriginal returned invalid mapping: 66 -> 66 is not in range of original text [0, 65] at androidx.compose.foundation.internal.InlineClassHelperKt.throwIllegalStateException(InlineClassHelper.kt:26) at androidx.compose.foundation.text.ValidatingOffsetMappingKt.validateTransformedToOriginal(ValidatingOffsetMapping.kt:138) at androidx.compose.foundation.text.ValidatingOffsetMappingKt.throwIfNotValidTransform(ValidatingOffsetMapping.kt:78) at androidx.compose.foundation.text.ValidatingOffsetMappingKt.throwIfNotValidTransform$default(ValidatingOffsetMapping.kt:61) at androidx.compose.foundation.text.ValidatingOffsetMappingKt.filterWithValidation(ValidatingOffsetMapping.kt:37) at androidx.compose.foundation.text.TextFieldScrollKt.defaultTextFieldScroll(TextFieldScroll.kt:129) at androidx.compose.foundation.text.TextFieldScroll_androidKt.textFieldScroll(TextFieldScroll.android.kt:29) at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$5$1.invoke(CoreTextField.kt:566) at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$5$1.invoke(CoreTextField.kt:556) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambda.kt:122) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambda.kt:122) at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:235) at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2838) at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Composer.kt:3216) at com.mohamedrejeb.richeditor.ui.material3.RichTextEditorKt$RichTextEditor$3$1.invoke(RichTextEditor.kt:147)

Way to Reproduce :

  1. I moved Cursor from Bottom to somewhere in middle
  2. Then again moved to last index
  3. And then wrote 2 3 words and it crashes

as well as same crash happens when im typing too fastly

Screen_recording_20251206_234636.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions