Skip to content

macOS: ⌘++ shortcut misrecognized as ⌘+- when using Pinyin – Simplified input method #20003

@snowflysky

Description

@snowflysky

Describe the bug

On macOS, when the system input method is switched to Pinyin – Simplified, the shortcut ⌘++ is incorrectly recognized as ⌘+-. Tracing the code shows that the physical equals (=) key is mapped to Avalonia’s minus (-) key? But actually, on the keyboard layout, the "+" and "=" symbols share the same physical key.

screenshot
Image

Image

To Reproduce

this.KeyBindings.Add(new KeyBinding { Gesture = new KeyGesture(Key.OemPlus, KeyModifiers.Meta), Command = mainWindowViewModel.DoSomeThingCommand, CommandParameter = "OemPlus" });
this.KeyBindings.Add(new KeyBinding { Gesture = new KeyGesture(Key.Add, KeyModifiers.Meta), Command = mainWindowViewModel.DoSomeThingCommand ,CommandParameter = "Add" });
this.KeyBindings.Add(new KeyBinding { Gesture = new KeyGesture(Key.OemMinus, KeyModifiers.Meta), Command = mainWindowViewModel.DoSomeThingCommand, CommandParameter = "OemMinus" });

AvaloniaApplication5.zip

  1. Add and switch to the Pinyin – Simplified input method in macOS.
  2. Run minimal reproduction code.
  3. Press ⌘++.
  4. Observe that the app responds to ⌘+- instead.

Expected behavior

⌘++ should be correctly recognized as ⌘++.

Avalonia version

11.3.8, 12.0.999-cibuild0059812-alpha

OS

macOS

Additional context

This issue does not occur when using the ABC Keyboard input method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions