I have created a search panel with an input. I feed the keyboard events from that input into the CodeMirror view with runScopeHandlers.
I have key bindings:
- Mod+Shift+h for replaceAll
- Mod+h for replaceNext
While my search panel input has focus, Mod+Shift+h will call replaceAll just fine. But when I have cap locks on, then Mod+Shift+h will instead call replaceNext. The difference between the two keyboard events is if cap locks is on then key=’h’ instead of ‘H’.
The issue happens in keymap.ts runHandlers line 250…
if (runFor(scopeObj[prefix + modifiers(name, event, !isChar)])) {
This is the first runFor check that’s called. The third argument for modifiers says that shift is always false. So when cap locks in ON it’ll return “Ctrl+h” which matches replaceNext exactly and calls that one (which we don’t want). When cap locks is OFF it’ll return “Ctrl+H” which doesn’t match anything, then it’ll fall through and call a runFor that allows the shift modifier.
Not sure what the best fix is here…