Skip to content

Support composing text for Native Text Input - #3569

Open
Andrei Salavei (ASalavei) wants to merge 8 commits into
jb-mainfrom
andrei.salavei/niti-support-marked-text
Open

Andrei Salavei (ASalavei) wants to merge 8 commits into
jb-mainfrom
andrei.salavei/niti-support-marked-text

Conversation

@ASalavei

Copy link
Copy Markdown
  • Add didUpdateMarkedRange() hack to keep cursor visible after adding marked text input
  • Remove marked text support from the BasicTextFieldInputDelegate and CoreTextFieldInputDelegate - it's not needed for the password autocomplete.
  • Add optional list of annotations for methods that updates composition in the TextEditingScope.

Fixes https://youtrack.jetbrains.com/issue/CMP-9999/iOS-NITI-Implement-markedText-methods

Release Notes

Fixes - iOS

  • Fix composing text indication for Native Text Input

edit(requireUpdateView = false) {
setComposingText(markedText, 1)
}
markedText ?: return

Choose a reason for hiding this comment

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

if markedText == null shouldn't we also call unmarkText ?

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.

it should be markedText ?: "" instead - updated.

val range = currentTextFieldValue?.composition ?: currentTextFieldValue?.selection ?: return
edit {
setComposingText(markedText, 1)
val newSelection = TextRange(start = range.start + selectedRange.start, end = range.start + selectedRange.end)

@svastven Vendula Švastalová (svastven) Nov 4, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we use range.min here instead of range.start so the new selection range is not dependent on the direction of the previous selection?

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.

Good question. Inverted ranges can potentially be an issue. However, currentTextFieldValue?.composition and currentTextFieldValue?.selection guarantee that text range is correct, as well as selectedRange.
Generally - we're using start and end all over the text input code, so I would keep like this to match the rest. If we'll face the issue - we'll refactor it to min/max.

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