(cm, key, modifier)
| 2502 | */ |
| 2503 | // TODO: Figure out a way to catch capslock. |
| 2504 | function handleKeyEvent_(cm, key, modifier) { |
| 2505 | if (isUpperCase(key)) { |
| 2506 | // Convert to lower case if shift is not the modifier since the key |
| 2507 | // we get from CodeMirror is always upper case. |
| 2508 | if (modifier == 'Shift') { |
| 2509 | modifier = null; |
| 2510 | } |
| 2511 | else { |
| 2512 | key = key.toLowerCase(); |
| 2513 | } |
| 2514 | } |
| 2515 | if (modifier) { |
| 2516 | // Vim will parse modifier+key combination as a single key. |
| 2517 | key = modifier + '-' + key; |
| 2518 | } |
| 2519 | vim.handleKey(cm, key); |
| 2520 | } |
| 2521 | |
| 2522 | // Closure to bind CodeMirror, key, modifier. |
| 2523 | function keyMapper(key, modifier) { |
no test coverage detected