Status Update
Comments
si...@google.com <si...@google.com>
qq...@google.com <qq...@google.com> #2
Hi,
I also see my text cut off when I set maxLines = 2
. Is it the same issue?
Box(
modifier =
Modifier.size(
width = 108dp,
height = 34dp,
),
contentAlignment = Alignment.Center,
) {
BasicText(
text = "text text text",
maxLines = 2,
autoSize = AutoSize.StepBased(minFontSize = 1.sp, maxFontSize = 13.sp, stepSize = 0.2.sp),
)
}
si...@google.com <si...@google.com>
se...@google.com <se...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Jossi Wolf <
Link:
Fix TextAutoSize bug with maxLines = 1
Expand for full commit details
Fix TextAutoSize bug with maxLines = 1
We were overcaching the paragraphIntrinsics in MultiParagraphLayoutCache when mutating the style. For `AutoSizeStepBased` instances with biased windows (more values smaller/bigger than the optimal), this could result in performing layout with outdated intrinsics, and thus an outdated style and font size, without surfacing this in the TextLayoutResult.
Test: New MultiParagraphLayoutCacheTests and manual testing
Relnote: Fixed a bug in BasicText with TextAutoSize and maxLines set to 1.
Fixes: 376834366
Change-Id: Ic0450c763c5d764492995b44ee1fe570246a9689
Files:
- M
compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCacheTest.kt
- M
compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCache.kt
Hash: e1b712d78cc60384ed67a56c006148291ba146a6
Date: Tue Jan 07 18:52:26 2025
se...@google.com <se...@google.com> #4
#2, yeah, that's the same issue.
se...@google.com <se...@google.com> #5
Thanks @jo...@google.com for fixing this! Do you know when the fix would be available for g3 apps?
se...@google.com <se...@google.com> #6
Moving the internal discussion offline. The bug is fixed and the fix available in snapshot builds. We will comment on this issue when the bug fix is included in a release.
se...@google.com <se...@google.com> #7
se...@google.com <se...@google.com> #8
Thanks for the report, super helpful!
A patch is coming for CoreTextField shortly, investigating the selection behavior for Text as well.
se...@google.com <se...@google.com> #9
Checking TextView, it looks like the non-editable selection doesn't need cleared on back. Thanks for report!
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit de1034714344ecdfc22f94a1244ab076cbc066b1
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Jul 13 17:12:50 2021
When text is selected in compose, back deselects
Matches Android platfrom behavior of intercepting back key up to dismiss
selection popups and deselect text.
Bug:
Test: new unit tests
Relnote: "TextField now clears selection when back button is pressed,
which matches Android EditText behavior."
Change-Id: I3ca164d09ee6d82f292aacfd2df0af05643cb1aa
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/api/restricted_current.txt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSelectionOnBackTest.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyEventHelpersTest.kt
A compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.android.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.kt
A compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.desktop.kt
Description
With traditional views, if you have the keyboard open with text selection handle bars being shown, the following happens when you press the back button:
Ideally, Compose would follow this same behavior automatically as well, if possible.
I attached two videos to the report. One shows the (ideal/correct) behavior with traditional views. The second shows the (current/incorrect) behavior with Compose as of today (1.0.0-alpha08 snapshot).