Skip to content

Use TextRange.min/max instead of start/end in TextEditingScope#2982

Merged
Alexander Maryanovsky (m-sasha) merged 1 commit into
jb-mainfrom
m-sasha/fix-reversed-selection-crash
Apr 15, 2026
Merged

Use TextRange.min/max instead of start/end in TextEditingScope#2982
Alexander Maryanovsky (m-sasha) merged 1 commit into
jb-mainfrom
m-sasha/fix-reversed-selection-crash

Conversation

@m-sasha

Copy link
Copy Markdown

Replace usage of TextRange.start/end in favor of min/max in TextEditingScope for BTF2, which caused a crash when start > end.

Fixes https://youtrack.jetbrains.com/issue/CMP-10082

Testing

Tested manually and added a unit test.

        val textField2State = rememberTextFieldState(
            initialText = "abcdef",
            initialSelection = TextRange(6)
        )
        TextField(
            state = textField2State,
            modifier = Modifier
                .width(200.dp)
        )

This should be tested by QA

Release Notes

Fixes - Multiple Platforms

  • Fixed crash when selecting text right-to-left and then typing a character via IME.

…ngScope for BTF2, which caused a crash when start > end.
@m-sasha Alexander Maryanovsky (m-sasha) merged commit debecae into jb-main Apr 15, 2026
17 checks passed
@m-sasha Alexander Maryanovsky (m-sasha) deleted the m-sasha/fix-reversed-selection-crash branch April 15, 2026 12:49
Vlad Konstantinov (Kpotko) added a commit that referenced this pull request Apr 21, 2026
Replace usage of TextRange.start/end in favor of min/max in
TextEditingScope for BTF2, which caused a crash when start > end.

This is a cherry-pick of
#2982

## Testing
N/A

## Release Notes
### Fixes - Multiple Platforms
- Fixed crash when selecting text right-to-left and then typing a
character via IME.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants