Skip to content

Fix Hangul output in iOS and in Safari#2454

Merged
Schahen merged 6 commits intojb-mainfrom
sh/CMP-8773-hangul-input
Oct 10, 2025
Merged

Fix Hangul output in iOS and in Safari#2454
Schahen merged 6 commits intojb-mainfrom
sh/CMP-8773-hangul-input

Conversation

@Schahen
Copy link
Copy Markdown

@Schahen Schahen commented Oct 8, 2025

Correct behaviour for Hangul input under certain circumstances

Fixes [https://youtrack.jetbrains.com/issue/CMP-8773]

Testing

./gradlew testWeb

Release Notes

Fixes - Web

  • Mobile. Composite input. When a syllable block is created, a new block is added instead of replacing the old one

@Schahen Schahen requested a review from eymar October 8, 2025 15:52
if (deleteSize > 0) {
add(DeleteSurroundingTextCommand(deleteSize, 0))
} else if (deleteSize == 0) {
add(BackspaceCommand())
Copy link
Copy Markdown
Member

@eymar eymar Oct 8, 2025

Choose a reason for hiding this comment

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

As I remember from the logs you shared from iPad, only deleteContentBackward was dispatched there for this type of input.

Is it necessary to add this check (deleteSize == 0) here too?


The name of the events suggests that deleteContentBackward can indeed have no selection - so just delete like a backspace would do.

But insertReplacementText hints that a selection must be present to replace something.

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 catch! - this is fallacy of tuning something to test - (in this case, for SafariCompositeInput::input hangul-hol`) let me fix test instead

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.

@eymar fixed Safari test and removed this snippet

Copy link
Copy Markdown
Member

@eymar eymar left a comment

Choose a reason for hiding this comment

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

LGTM!

// The system first tells us to delete the old text,
// and then it would send the "insertText" event.
val deleteSize = deleteContentBackwardSize
val deleteSize = deleteContentBackwardSize ?: 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in this case it will go to else if branch and execute Backspace command.

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.

@eymar shouldn't we treat the null (deleteContentBackwarSize was not set at all) like zero?

This leads to Removing Safari:: `input hangul-hol` test - unfortunately we can not change state of html input which is needed for this test to behave properly
Other possible solution would be not to set deleteContentBackwardSize if it somehow came from event already but this will mean we leak testing logic into application. This price would be too high
@Schahen Schahen merged commit 26d9d44 into jb-main Oct 10, 2025
16 of 18 checks passed
@Schahen Schahen deleted the sh/CMP-8773-hangul-input branch October 10, 2025 15:20
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