-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when setting the maxLines with <ol> label #404
Comments
Are you using any kind of height modifier on RichText? If so, try removing it to see if the bug persists. I’ve encountered this issue as well, but I’m unable to replicate it with the provided sample. |
This is my simplified code and I only set maxLines: val state = rememberRichTextState()
LaunchedEffect(htmlText) {
state.setHtml(htmlText)
}
RichText(
state = state,
maxLines = 25
) My current version is |
When I set the maxLines, the latter part containing
<ol>
is hidden, the code has crashed.java.lang.IndexOutOfBoundsException: Index -11 out of bounds for length 10
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.util.Objects.checkIndex(Objects.java:359)
at java.util.ArrayList.get(ArrayList.java:434)
at androidx.compose.ui.text.MultiParagraph.getHorizontalPosition(MultiParagraph.kt:624)
at androidx.compose.ui.text.TextLayoutResult.getHorizontalPosition(TextLayoutResult.kt:491)
at com.mohamedrejeb.richeditor.model.RichTextState.adjustRichParagraphLayout(RichTextState.kt:2672)
at com.mohamedrejeb.richeditor.model.RichTextState.onTextLayout$richeditor_compose_release(RichTextState.kt:2649)
at com.mohamedrejeb.richeditor.ui.BasicRichTextKt$BasicRichText$2.invoke$lambda$3$lambda$2(BasicRichText.kt:92)
at com.mohamedrejeb.richeditor.ui.BasicRichTextKt$BasicRichText$2.$r8$lambda$kK6PA19JID0lDEmS3UotFNDZ_Ww(Unknown Source:0)
at com.mohamedrejeb.richeditor.ui.BasicRichTextKt$BasicRichText$2$$ExternalSyntheticLambda0.invoke(Unknown Source:10)
at androidx.compose.foundation.text.modifiers.TextAnnotatedStringNode.measure-3p2s80s(TextAnnotatedStringNode.kt:397)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:116)
at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:116)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:252)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:251)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2303)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:500)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:256)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1617)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:36)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:620)
at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release(LayoutNode.kt:1145)
at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release$default(LayoutNode.kt:1136)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:356)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded(MeasureAndLayoutDelegate.kt:514)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureAndRelayoutIfNeeded$default(MeasureAndLayoutDelegate.kt:491)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout(MeasureAndLayoutDelegate.kt:377)
at androidx.compose.ui.platform.AndroidComposeView.measureAndLayout(AndroidComposeView.android.kt:971)
at androidx.compose.ui.node.Owner$-CC.measureAndLayout$default(Owner.kt:228)
at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(AndroidComposeView.android.kt:1224)
at android.view.View.draw(View.java:25180)
at android.view.View.updateDisplayListIfDirty(View.java:24036)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4764)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4736)
at android.view.View.updateDisplayListIfDirty(View.java:23982)
Here is my html text:
<p><strong>Job Description:</strong></p>\n<ol>\n<li>Responsible for the design of Document AI product solutions, transforming algorithmic technology into user-friendly product features.<br>Work closely with the algorithm development team to ensure the feasibility and innovation of product solutions.<br>Conduct market research to understand user needs and integrate feedback into product solutions.<br>Write product documents, including requirement analysis, design documents, and user manuals.<br>Requirements:\n<ul>\n<li>Bachelor's degree or above in Computer Science, Artificial Intelligence, Statistics, Mathematics, Product Design, or related fields.<br>Deep understanding of product design and user experience.<br>Good cross-departmental communication skills and team spirit.<br>Experience in educational technology or intelligent scheduling system product solution design is preferred.<br>Proficient in English and Chinese, capable of writing and reading technical documents..<br>Compensation:</li>\n</ul>\n</li>\n<li>Highly competitive salary.\n<ul>\n<li>Guaranteed 13th-month pay.</li>\n<li>Transportation, communication, and meal allowances.</li>\n</ul>\n</li>\n<li>Discretionary bonus and project commission.</li>\n<li>Weekend off.\n<ul>\n<li>Beautiful office environment.</li>\n<li>Humanized management.</li>\n</ul>\n</li>\n<li>Application Method:</li>\n</ol>\n<p>Please send your resume and cover letter to [[email protected]].</p>
The text was updated successfully, but these errors were encountered: