Skip to content

StyledText treats shortcuts incorrectly with Japanese keyboard layout #3306

@tmssngr

Description

@tmssngr

Describe the bug
If the US keyboard layout is selected, a configured Cmd+A shortcut works. Not so, if the "Japanese - Kana" keyboard layout is selected.

To Reproduce
Run this snippet, one time with US keyboard layout, another time with Japanese keyboard layout.

import org.eclipse.swt.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class StyledTextCtrlATest {

	public static void main(String[] args) {
		final Display display = new Display();

		final Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());

		final StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
		styledText.setKeyBinding('a' | SWT.MOD1, ST.SELECT_ALL);
		styledText.setText("some text");

		shell.setSize(400, 300);
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		display.dispose();
	}
}

Expected behavior
I would expect in both cases the selection of all text.

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    Tried on macOS 14, though I think the problem might apply to all platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions