compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Hotkeys when typing Korean in a TextField in macOs on Desktop Issue

Open eshc123 opened this issue 1 year ago • 2 comments

Describe the bug I am developing a Desktop Application, but unlike Windows, when I enter Korean language in TextField on macOs, if I use shortcut keys such as Select All (command + a) and Copy (command + c), they are not applied at once, but I have to press them twice. (* English, numbers, etc. can be done at once.)

Affected platforms

  • Desktop (macOS)

Versions

  • Kotlin version*: 1.9.0
  • Compose Multiplatform version*: 1.6.1
  • OS version(s)* (required for Desktop and iOS issues): macOS Sonoma 14.4.1
  • JDK (for desktop issues): 17

Screenshots

2024-04-169 23 48-ezgif com-video-to-gif-converter When viewing the gif, in English, the text is not underlined. In Korean, the first time you press the shortcut(command + a) after the underline appears, the shortcut is not applied and the underline disappears. If you press the shortcut(command + a) again, it will be applied.

eshc123 avatar Apr 16 '24 00:04 eshc123

Seems like duplicate of #3497

MatkovIvan avatar Apr 18 '24 08:04 MatkovIvan

I thought it was a JDK version issue, so I tried changing the version, but unfortunately, the same issue occurred. The difference with issue #3497 is that in my case, the [Cmd+C/V/X shortcut] works fine if I type it multiple times. However, it is quite inconvenient that I have to type the shortcut twice for it to work.

eshc123 avatar Apr 19 '24 03:04 eshc123

This is unrelated to #3497 but is a bug in Java/Swing. The exact same behavior reproduces with a JTextField.

m-sasha avatar Aug 21 '24 08:08 m-sasha

It seems AWT is just not sending us the KEY_DOWN event corresponding to cmd-a when "composing" the last character. Below is the log of events when pressing, for example g, h, cmd-a

java.awt.event.InputMethodEvent[INPUT_METHOD_TEXT_CHANGED, "" + "ㅎ", 0 characters committed, caret: TextHitInfo[0T], visible position: TextHitInfo[-1T]] on canvas0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=71,keyText=G,keyChar='ㅎ',keyLocation=KEY_LOCATION_STANDARD,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x0] on canvas0
java.awt.event.InputMethodEvent[INPUT_METHOD_TEXT_CHANGED, "" + "호", 0 characters committed, caret: TextHitInfo[0T], visible position: TextHitInfo[-1T]] on canvas0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=72,keyText=H,keyChar='ㅗ',keyLocation=KEY_LOCATION_STANDARD,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x0] on canvas0
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=157,keyText=⌘,keyChar=Undefined keyChar,modifiers=⌘,extModifiers=⌘,keyLocation=KEY_LOCATION_LEFT,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x9d] on canvas0
java.awt.event.InputMethodEvent[INPUT_METHOD_TEXT_CHANGED, "" + "호", 0 characters committed, caret: TextHitInfo[0T], visible position: TextHitInfo[-1T]] on canvas0
java.awt.event.InputMethodEvent[INPUT_METHOD_TEXT_CHANGED, "호" + "", 1 characters committed, caret: TextHitInfo[0L], visible position: TextHitInfo[0L]] on canvas0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=65,keyText=A,keyChar='a',modifiers=⌘,extModifiers=⌘,keyLocation=KEY_LOCATION_STANDARD,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x41] on canvas0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=157,keyText=⌘,keyChar=Undefined keyChar,keyLocation=KEY_LOCATION_LEFT,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x9d] on canvas0

m-sasha avatar Aug 21 '24 09:08 m-sasha

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Aug 26 '24 13:08 okushnikov