Repository navigation
Android: stop mouse presses below message text crashing selection - #945
Merged
Merged
Conversation
Compose Foundation 1.12 lets a mouse press in a SelectionContainer's empty space start a selection. A press below the last Text resolves both slots past the end, and MultiSelectionLayout.crossStatus indexes out of bounds. Assistant messages ending in a code block or padding hit this on a plain mouse click. Turn off ComposeFoundationFlags.isMouseSelectionBetweenTextEnabled at startup until the BOM ships Foundation 1.13 stable, which fixes it. Fixes #942 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Automated review: no finding that 2+ of 3 passes agreed on.
1 finding(s) from a single pass, not posted
android/app/src/androidTest/java/dev/opencode/mobile/platform/ComposeFoundationWorkaroundsTest.kt:12medium: Import ofbottomCenterdoes not resolve, so the new androidTest source set fails to compile (deepseek-v4.1-flash)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.040 · 1 pass(es) stopped early
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Android crash in #942:
IndexOutOfBoundsExceptioninMultiSelectionLayout.getCrossStatusafter a mouse or trackpad press in a message.2026.09.00) turns onComposeFoundationFlags.isMouseSelectionBetweenTextEnabledby default. With it on,SelectionContaineradds its own mouse handler, so a press anywhere in the container starts a selection.Text,SelectionLayoutBuilderputs both slots at2 * size.crossStatusthen readsinfoList[size]. Any assistant message with two or more text blocks crashes on a click in its bottom padding or on a final code block, table or rule. Touch input uses a different path and is unaffected.OpenCodeMobileApplication.onCreatethrough a newComposeFoundationWorkaroundshelper. Mouse selection that starts on text works as before; dragging from the empty space between texts no longer starts a selection (the 1.11 behaviour).crossStatusreturnsCOLLAPSEDfor equal even slots). There is no stable 1.13 yet, so remove the workaround when the BOM moves to it.Checks
ComposeFoundationWorkaroundsTest(mouse press below the last of two Texts in aSelectionContainer), run on an API 37 emulator:IndexOutOfBoundsException: Index 2 out of bounds for length 2atMultiSelectionLayout.getCrossStatus(SelectionLayout.kt:184), the same frame as Crashlytics:app:assembleDebugand:app:testDebugUnitTestpass. ktlint reports nothing in the changed files.Risks / Follow-ups
Fixes #942
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.