Fixed
Status Update
Comments
se...@google.com <se...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit d461de1e1e0dd55aacecbc5caaa35b398973d148
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Jun 21 17:02:07 2022
Don't throw from getLineForOffset
Documentation has always matched platform behavior of returning 0,
maxLines for invalid inputs.
Previously, we threw when i < 0 || i > textLength. This never matched
docs.
New, we return 0 or lineCount -1 for 0 > input < textLength
Relnote: "TextLayoutResult.getLineForOffset does not throw."
Fixes: b/235876324
Test: ./gradlew :compose:ui:ui-text:cAT
Change-Id: Idc5d6d0721a0241b9992db60d0ddcf3fcc52ed44
M compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTest.kt
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraph.kt
https://android-review.googlesource.com/2132279
Branch: androidx-main
commit d461de1e1e0dd55aacecbc5caaa35b398973d148
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Jun 21 17:02:07 2022
Don't throw from getLineForOffset
Documentation has always matched platform behavior of returning 0,
maxLines for invalid inputs.
Previously, we threw when i < 0 || i > textLength. This never matched
docs.
New, we return 0 or lineCount -1 for 0 > input < textLength
Relnote: "TextLayoutResult.getLineForOffset does not throw."
Fixes:
Test: ./gradlew :compose:ui:ui-text:cAT
Change-Id: Idc5d6d0721a0241b9992db60d0ddcf3fcc52ed44
M compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTest.kt
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraph.kt
Description
- Jetpack Compose component used: TextLayoutResult.getLineForOffset
- Android Studio Build: #AI-212.5712.43.2112.8609683
- Kotlin version: 1.6.21
- Devices/Android versions reproduced on: Pixel 2 API 28
- Keyboard (i.e. Gboard, Samsung, etc): Gboard
Documentation for getLineForOffset says
* If you ask for a position before 0, you get 0; if you ask for a position
* beyond the end of the text, you get the last line.
Implementation calls
requireIndexInRangeInclusiveEnd(offset)
and throws an Exception if the offset is out of bounds.