-
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 Korean text input #406
Conversation
Fixes JetBrains/compose-multiplatform#2600 1. We shouldn't skip input events with empty text, they will clear the current uncommitted text. In case of Korean, Swing will send a clear event of the previous char when we press Space, and send a separate "KEY_TYPED" event for the last character: - press q -> q uncommitted - press w -> commit q, w uncommitted - press Space -> discard committed text (event with empty text), send KEY_TYPED event with w and KEY_TYPED event with Space 2. Add tests for test input. I traced Swing events on each OS to mimic integration tests (It is difficult to write real input tests)
platform.textInputService.onInputEvent(event) | ||
} | ||
} | ||
// Which OSes and which input method could produce such events? We need to have some |
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.
Maybe we should ask someone knowledgeable? I bet it's not here for nothing.
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.
It may be only for Swing components. This method isn't triggered on Linux/Windows/macOS
I created a separate issue that can be related to this: JetBrains/compose-multiplatform#2758
} | ||
|
||
@Test | ||
fun `q, w, backspace 3x (Chinese, macOS)`() = runTypeTest { |
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.
the test name mentions the OS (macOS in this case).
But how does the test actually configure the OS? what is the difference in tests for different OS?
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.
Seems I see the difference. Every test sends the sequence of key events. Such sequences are different for different OS.
So it's not necessary to specify/configure the OS specific things for the test, beside sending the OS-specifc key event sequence. So these tests may run on any OS.
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.
Added a comment in the description of class.
The name of OS is important information.
Fixes JetBrains/compose-multiplatform#2600 1. We shouldn't skip input events with empty text, they will clear the current uncommitted text. In case of Korean, Swing will send a clear event of the previous char when we press Space, and send a separate "KEY_TYPED" event for the last character: - press q -> q uncommitted - press w -> commit q, w uncommitted - press Space -> discard committed text (event with empty text), send KEY_TYPED event with w and KEY_TYPED event with Space 2. Add tests for test input. I traced Swing events on each OS to mimic integration tests (It is difficult to write real input tests)
Fixes JetBrains/compose-multiplatform#2600