Skip to content

Adopt PlatformTextInputService2#2990

Merged
Andrei Salavei (ASalavei) merged 38 commits into
jb-mainfrom
andrei.salavei/Adopt-PlatformTextInputService2
May 11, 2026
Merged

Adopt PlatformTextInputService2#2990
Andrei Salavei (ASalavei) merged 38 commits into
jb-mainfrom
andrei.salavei/Adopt-PlatformTextInputService2

Conversation

@ASalavei

Copy link
Copy Markdown

Extend the functionality of the TextEditingScope and adjust its behaviour to align with the EditProcessor's commands.
Apply recomposeAndLayout after edit commands to recalculate the text and layout state.
Refactor the UIKitTextInputService to use the PlatformTextInputMethodRequest directly to bypass issues caused by delays in mutable state propagation.
Add the UIKitTextInputServiceAdapter to support the deprecated PlatformTextInputService.

Fixes https://youtrack.jetbrains.com/issue/CMP-7832/iOS-Adopt-PlatformTextInputService2
Fixes https://youtrack.jetbrains.com/issue/CMP-7983/BasicTextFieldTextFieldState-inputTransformation-reports-inconsistent-changes-between-Android-and-iOS
Fixes https://youtrack.jetbrains.com/issue/CMP-9566/BasicTextField-w-InputTransformation-incorrect-internal-state-on-iOS

Release Notes

Fixes - iOS

  • Fix issue where BasicTextField reported inconsistent changes between Android and iOS
  • Fix issue where a BasicTextField with InputTransformation may use the incorrect internal text state.

@ASalavei Andrei Salavei (ASalavei) force-pushed the andrei.salavei/Adopt-PlatformTextInputService2 branch from 0a329e6 to 48793e2 Compare April 30, 2026 13:29
@ASalavei Andrei Salavei (ASalavei) force-pushed the andrei.salavei/Adopt-PlatformTextInputService2 branch from 9f5fc0a to 1f0c16d Compare April 30, 2026 15:33
…vice2

# Conflicts:
#	compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/platform/IOSSkikoInput.ios.kt
#	compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/platform/UIKitTextInputService.ios.kt
#	compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.ios.kt
#	compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/window/NativeTextInputView.ios.kt
#	compose/ui/ui/src/uikitInstrumentedTest/kotlin/androidx/compose/ui/leaks/MemoryLeaksTest.kt
Comment thread .github/workflows/check-public-api.yml
@ASalavei Andrei Salavei (ASalavei) marked this pull request as draft May 4, 2026 12:53
@ASalavei Andrei Salavei (ASalavei) marked this pull request as ready for review May 4, 2026 15:33
newCursor + newCursorPosition - text.length
}
buffer.setSelectionCoerced(newCursorInBuffer, newCursorInBuffer)
setSelection(newCursorInBuffer, newCursorInBuffer)

Choose a reason for hiding this comment

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

I was against this change, but not a blocker, I guess.

@ASalavei Andrei Salavei (ASalavei) May 4, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Vendula Švastalová (@svastven) , please take a look here

Choose a reason for hiding this comment

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

To me, current state reads better, that's why I gave the suggestion. Should setSelection implementation change later, then setSelection is probably no longer the best name for the function (?). Willl leave the decision up to you Andrei Salavei (@ASalavei)

@ASalavei Andrei Salavei (ASalavei) May 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is the question of style only.
My take here: both, setSelection and setComposingRegion use only one function call inside which I think does not bring any additional value and does not improve clarity. I would rather remove these functions and use buffer directly.

Vendula Švastalová (@svastven) , Alexander Maryanovsky (@m-sasha) ?

Choose a reason for hiding this comment

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

Sounds good to me

Choose a reason for hiding this comment

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

I would rather remove these functions and use buffer directly.

Do you mean remove the calls/delegation to these functions? Because I don't think you can remove the functions themselves...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ah, sorry - missed that fact. Have to change the reasoning then, it's not a matter of style anymore.
At the main workflow, the functions commitText and setComposingText modify the buffer. It means, all calls preferably should go to the buffer to improve readability and keep the function code solid.

Choose a reason for hiding this comment

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

This already exists in LegacyPlatformTextInputServiceAdapter.skiko.kt.

Would it not be better to reuse it, or at least parts of it?

@ASalavei Andrei Salavei (ASalavei) May 6, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Alexander Maryanovsky (@m-sasha) , it cannot be the LegacyPlatformTextInputServiceAdapter due to the implementation specifics. Most likely it should be a new class exposed from the "ui-text". My ides was to avoid that. WDYT?

…vice2

# Conflicts:
#	compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/text/input/ComposeTextInputConnection.ios.kt
@ASalavei Andrei Salavei (ASalavei) merged commit 1d5979f into jb-main May 11, 2026
16 checks passed
@ASalavei Andrei Salavei (ASalavei) deleted the andrei.salavei/Adopt-PlatformTextInputService2 branch May 11, 2026 13:03
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.

4 participants