Skip to content
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

Don't crash, and allow selection in SelectionContainer to start when drag starts below the bounds of the visible text #1230

Merged

Conversation

m-sasha
Copy link

@m-sasha m-sasha commented Mar 29, 2024

See the explanation for this change here.

Proposed Changes

Use textLayoutResult.size rather than textLayoutResult.multiParagraph when determining the text bounds for starting the selection in SelectionContainer. This is how Android does it.

Testing

Test: Tested manually, and added a new unit test.
This PR should be verified by QA.

Issues Fixed

Fixes: JetBrains/compose-multiplatform#4555

…drag starts below the bounds of the visible text.
Copy link
Collaborator

@igordmn igordmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to revert the change.

This change was originally introduced in 535fb6f.

The surrounding code was adapted for mobile "handles", and mouse position was equal to the bottom side of the handle, which was out of the bounds.

Now, it uses a proper mouse position (I tested localPosition), and everything should work correctly.

@m-sasha m-sasha merged commit 28cad83 into jb-main Apr 2, 2024
6 checks passed
@m-sasha m-sasha deleted the m-sasha/fix-selection-container-press-outside-text branch April 2, 2024 15:36
m-sasha added a commit that referenced this pull request Apr 4, 2024
…drag starts below the bounds of the visible text (#1230)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants