onivim / oni2

Native, lightweight modal code editor
https://v2.onivim.io
MIT License
7.83k stars 281 forks source link

Key mappings using `Alt` don't work #3840

Open daleconboy opened 2 years ago

daleconboy commented 2 years ago

I tried applying some key mappings on a Mac for the Option key via the likes of <A-h> but the mappings aren't taking effect.

Looking at the logs when pressing the key combinations in question, it's reporting that alt = false , but altGr = true.

keybindings.js

[
  {
    "key": "<A-h>",
    "command": "window.moveLeft",
    "when": "normalMode"
  },
  {
    "key": "<A-l>",
    "command": "window.moveRight",
    "when": "normalMode"
  }
]

Oni Log output when pressing Opt-h

[INFO]  [609.252s] Oni2.Store.dispatch : dispatch: KeyDown {
  key =
  [(KeyPress.PhysicalKey
      { PhysicalKey.key = (Key.Character <opaque>);
        modifiers =
        { Modifiers.control = false; alt = false; altGr = true;
          shift = false; super = false }
        });
    (KeyPress.PhysicalKey
       { PhysicalKey.key = (Key.Character <opaque>);
         modifiers =
         { Modifiers.control = false; alt = false; altGr = false;
           shift = false; super = false }
         })
    ];
  scancode = 11; time = <opaque>}
[INFO]  [609.253s] Oni2.Store.dispatch : dispatch: (TextInput ("\203\153", <opaque>))
[DEBUG] [609.254s] Oni2.Store.dispatch : After: (TextInput ("\203\153", <opaque>))