From f7172c98d9995ba2e2ae2930ccea32fca6a47e22 Mon Sep 17 00:00:00 2001 From: Thomas Singer Date: Fri, 15 May 2026 14:39:47 +0200 Subject: [PATCH] StyledText treats shortcuts incorrectly with Japanese keyboard layout #3306 On MacOS 14 with "Japanese Kana" keyboard pressing Cmd+A results in event.keycode == 12385 while event.character == 'a'. --- .../common/org/eclipse/swt/custom/StyledText.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java index 9d107a8495..13dcdb0849 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java @@ -5728,12 +5728,13 @@ void handleHorizontalScroll(Event event) { * @param event keyboard event */ void handleKey(Event event) { - int action; caretAlignment = PREVIOUS_OFFSET_TRAILING; + int action = SWT.NULL; if (event.keyCode != 0) { // special key pressed (e.g., F1) action = getKeyBinding(event.keyCode | event.stateMask); - } else { + } + if (action == SWT.NULL && event.character != 0) { // character key pressed action = getKeyBinding(event.character | event.stateMask); if (action == SWT.NULL) {