StyledText treats shortcuts incorrectly with Japanese keyboard layout #3306#3307
StyledText treats shortcuts incorrectly with Japanese keyboard layout #3306#3307tmssngr wants to merge 1 commit into
Conversation
|
Is this a problem only on on macOS 14? That's out of date now. Is it a problem on 15.7.x and 26.x? |
|
No, this problem is reproducible with MacOS 26.5, too. I have not tried on other systems though. Are these failing Windows tests caused by this PR? |
d426f8a to
4ff9ad6
Compare
…clipse-platform#3306 On MacOS 14 with "Japanese Kana" keyboard pressing Cmd+A results in event.keycode == 12385 while event.character == 'a'.
|
Is this worth merging? |
|
This change seems to be modying core key handling of |
|
Please find steps to reproduce in #3306. I thought to have explained the reason in the commit message. |
|
Thank you for the reference. I usually do not look at the commit message but only at the PR description, and I did not recognize that there seems to be an implicit reference to the issue in the PR title. It helps to just have a proper reference in the description. Still I do not see an explanation of the conceptual idea of the fix and why it may be sound in the issue, the commit message or the PR description. It just says that some combination of keycode and character does not work, but that does not say anything about the concept of the fix. |
|
Before my fix the event had the keycode 12385, so it took the if statement. But for that keycode, no keybinding existed, so nothing was done. Now it first tries with the keycode as before, but if no keybinding was found, it tries to look for a character keybinding, too. And then it finds something. |
|
Yes, so far I understand how exactly the problematic case works because of the change. |
|
Sorry, I don't understand what further information you need. If this is not sufficient for you, just close this PR. I had the hope that other users, especially in Japan, also would like to benefit from my fix. |
|
I tested this on Mac using the Japanese Kana keyboard layout. Without this PR pressing MOD1+A doesn't perform the Select All action, with this PR it does. I would think that MOD1 + A should perform the Select All action in all keyboard layouts. @HeikoKlare it seems like this fixes an edge case with the Japanese Kana keyboard layout (and possibly others) in the stand-alone use of the |
|
Further investigations... A workaround: styledText.setKeyBinding(12385 | SWT.MOD1, ST.SELECT_ALL); |
|
Seeing as how some folks are using AI to summarise issues/PRs, I'll add this one... What happensWhen you press Cmd + A (for "Select All") on a Japanese Kana keyboard layout:
The original code in StyledText.handleKey(Event event) only checked key bindings using The fix in this PRThe PR changes This makes standard shortcuts (like Cmd+A, Cmd+C, etc.) work even when the underlying macOS event reports a Japanese keycode for Latin keys under certain input methods. Why this occurs on Japanese layoutsmacOS (and other platforms with complex input methods / IME) often sends the "committed" or native character code in keyCode when using kana/kanji input modes, while still providing the base Latin character for compatibility. Eclipse's key binding system wasn't handling this mismatch for StyledText. |
Sure, it's definitely useful. But you mention the important point as well "as long as doesn't cause a regression". The code does not just add a specific if statement for the edge or the like, it changes how the method processes key event parameters in general. And I am not able to spend the time to get all the knowledge of how this works (including control and data flow of the method), in particular because the creator of such a change needs to have done that anyone and would the person I would expect to post the information together with the change proposal. So if there is someone who is confident with the change or invests the time into fully understanding the impact, it's of course fine for me to merge this. I just wanted to point out that I am not sure if there will be someone doing that (and that I least I will not be that person). |
On MacOS 14 with "Japanese Kana" keyboard pressing Cmd+A results in event.keycode == 12385 while event.character == 'a'.
This PR fixes the problem for me.