-
Notifications
You must be signed in to change notification settings - Fork 81
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
Fix initial cursor position in empty TextField when TextAlignment is set explicitly #1354
Fix initial cursor position in empty TextField when TextAlignment is set explicitly #1354
Conversation
@@ -57,6 +58,8 @@ internal class SkiaParagraph( | |||
internal val defaultFont | |||
get() = layouter.defaultFont | |||
|
|||
private val textAlign: TextAlign = layouter.textStyle.textAlign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to put it in a variable, just use it at the one place where it's needed.
It's both safer (no need to understand whether the value can change) and takes less memory.
compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/SkiaParagraph.skiko.kt
Outdated
Show resolved
Hide resolved
You should add unit tests for this.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Agree with @m-sasha, let's add unit tests for it
It seems we have one more issue duplicate - JetBrains/compose-multiplatform#2711 |
…Position` to make it more simple and intuitive
a8aed8f
to
f933000
Compare
compose/ui/ui-text/src/skikoTest/kotlin/androidx/compose/ui/text/SkikoParagraphTest.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/SkiaParagraph.skiko.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Ivan Matkov <[email protected]>
After focusing on the textfield and before entering any text, now blinking cursor will be positioned in accordance with TextAlignment.
Fixes https://youtrack.jetbrains.com/issue/COMPOSE-1360/
Fixes JetBrains/compose-multiplatform#2711
Fixes JetBrains/compose-multiplatform#3098
Fixes JetBrains/compose-multiplatform#4611
Testing
Manual testing.
Release Notes
Fixes - Multiple Platforms
TextField
with explicitly setTextAlignment
.Google CLA
You need to sign the Google Contributor’s License Agreement at https://cla.developers.google.com/.
This is needed since we synchronise most of the code with Google’s AOSP repository. Signing this agreement allows us to synchronise code from your Pull Requests as well.