@codingame/monaco-vscode-keybindings-service-override 9.0.2 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,5 @@
1
- import { CharCode } from 'vscode/vscode/vs/base/common/charCode';
2
- import { IMMUTABLE_CODE_TO_KEY_CODE, KeyCode, ScanCode, ScanCodeUtils, KeyCodeUtils, IMMUTABLE_KEY_CODE_TO_CODE } from 'vscode/vscode/vs/base/common/keyCodes';
1
+ import { IMMUTABLE_CODE_TO_KEY_CODE, ScanCodeUtils, KeyCodeUtils, IMMUTABLE_KEY_CODE_TO_CODE } from 'vscode/vscode/vs/base/common/keyCodes';
3
2
  import { ScanCodeChord, KeyCodeChord } from 'vscode/vscode/vs/base/common/keybindings';
4
- import { OperatingSystem } from 'vscode/vscode/vs/base/common/platform';
5
3
  import { BaseResolvedKeybinding } from 'vscode/vscode/vs/platform/keybinding/common/baseResolvedKeybinding';
6
4
 
7
5
  const CHAR_CODE_TO_KEY_CODE = [];
@@ -26,7 +24,7 @@ class NativeResolvedKeybinding extends BaseResolvedKeybinding {
26
24
  if (!binding) {
27
25
  return true;
28
26
  }
29
- if (IMMUTABLE_CODE_TO_KEY_CODE[binding.scanCode] !== KeyCode.DependsOnKbLayout) {
27
+ if (IMMUTABLE_CODE_TO_KEY_CODE[binding.scanCode] !== -1 ) {
30
28
  return true;
31
29
  }
32
30
  const a = this._mapper.getAriaLabelForScanCodeChord(binding);
@@ -43,16 +41,16 @@ class NativeResolvedKeybinding extends BaseResolvedKeybinding {
43
41
  return this._mapper.getDispatchStrForScanCodeChord(chord);
44
42
  }
45
43
  _getSingleModifierChordDispatch(chord) {
46
- if ((chord.scanCode === ScanCode.ControlLeft || chord.scanCode === ScanCode.ControlRight) && !chord.shiftKey && !chord.altKey && !chord.metaKey) {
44
+ if (((chord.scanCode === 157 || chord.scanCode === 161) ) && !chord.shiftKey && !chord.altKey && !chord.metaKey) {
47
45
  return 'ctrl';
48
46
  }
49
- if ((chord.scanCode === ScanCode.AltLeft || chord.scanCode === ScanCode.AltRight) && !chord.ctrlKey && !chord.shiftKey && !chord.metaKey) {
47
+ if (((chord.scanCode === 159 || chord.scanCode === 163) ) && !chord.ctrlKey && !chord.shiftKey && !chord.metaKey) {
50
48
  return 'alt';
51
49
  }
52
- if ((chord.scanCode === ScanCode.ShiftLeft || chord.scanCode === ScanCode.ShiftRight) && !chord.ctrlKey && !chord.altKey && !chord.metaKey) {
50
+ if (((chord.scanCode === 158 || chord.scanCode === 162) ) && !chord.ctrlKey && !chord.altKey && !chord.metaKey) {
53
51
  return 'shift';
54
52
  }
55
- if ((chord.scanCode === ScanCode.MetaLeft || chord.scanCode === ScanCode.MetaRight) && !chord.ctrlKey && !chord.shiftKey && !chord.altKey) {
53
+ if (((chord.scanCode === 160 || chord.scanCode === 164) ) && !chord.ctrlKey && !chord.shiftKey && !chord.altKey) {
56
54
  return 'meta';
57
55
  }
58
56
  return null;
@@ -94,7 +92,7 @@ class ScanCodeCombo {
94
92
  if (charCode === 0) {
95
93
  return ' --- ';
96
94
  }
97
- if (charCode >= CharCode.U_Combining_Grave_Accent && charCode <= CharCode.U_Combining_Latin_Small_Letter_X) {
95
+ if (charCode >= 768 && charCode <= 879 ) {
98
96
  return 'U+' + ( charCode.toString(16));
99
97
  }
100
98
  return ' ' + String.fromCharCode(charCode) + ' ';
@@ -119,8 +117,8 @@ class ScanCodeKeyCodeMapper {
119
117
  this._keyCodeToScanCode = [];
120
118
  }
121
119
  registrationComplete() {
122
- this._moveToEnd(ScanCode.IntlHash);
123
- this._moveToEnd(ScanCode.IntlBackslash);
120
+ this._moveToEnd(56 );
121
+ this._moveToEnd(106 );
124
122
  }
125
123
  _moveToEnd(scanCode) {
126
124
  for (let mod = 0; mod < 8; mod++) {
@@ -147,13 +145,13 @@ class ScanCodeKeyCodeMapper {
147
145
  }
148
146
  }
149
147
  registerIfUnknown(scanCodeCombo, keyCodeCombo) {
150
- if (keyCodeCombo.keyCode === KeyCode.Unknown) {
148
+ if (keyCodeCombo.keyCode === 0 ) {
151
149
  return;
152
150
  }
153
151
  const scanCodeComboEncoded = this._encodeScanCodeCombo(scanCodeCombo);
154
152
  const keyCodeComboEncoded = this._encodeKeyCodeCombo(keyCodeCombo);
155
- const keyCodeIsDigit = (keyCodeCombo.keyCode >= KeyCode.Digit0 && keyCodeCombo.keyCode <= KeyCode.Digit9);
156
- const keyCodeIsLetter = (keyCodeCombo.keyCode >= KeyCode.KeyA && keyCodeCombo.keyCode <= KeyCode.KeyZ);
153
+ const keyCodeIsDigit = ((keyCodeCombo.keyCode >= 21 && keyCodeCombo.keyCode <= 30) );
154
+ const keyCodeIsLetter = ((keyCodeCombo.keyCode >= 31 && keyCodeCombo.keyCode <= 56) );
157
155
  const existingKeyCodeCombos = this._scanCodeToKeyCode[scanCodeComboEncoded];
158
156
  if (keyCodeIsDigit || keyCodeIsLetter) {
159
157
  if (existingKeyCodeCombos) {
@@ -209,18 +207,18 @@ class ScanCodeKeyCodeMapper {
209
207
  return result;
210
208
  }
211
209
  guessStableKeyCode(scanCode) {
212
- if (scanCode >= ScanCode.Digit1 && scanCode <= ScanCode.Digit0) {
210
+ if (scanCode >= 36 && scanCode <= 45 ) {
213
211
  switch (scanCode) {
214
- case ScanCode.Digit1: return KeyCode.Digit1;
215
- case ScanCode.Digit2: return KeyCode.Digit2;
216
- case ScanCode.Digit3: return KeyCode.Digit3;
217
- case ScanCode.Digit4: return KeyCode.Digit4;
218
- case ScanCode.Digit5: return KeyCode.Digit5;
219
- case ScanCode.Digit6: return KeyCode.Digit6;
220
- case ScanCode.Digit7: return KeyCode.Digit7;
221
- case ScanCode.Digit8: return KeyCode.Digit8;
222
- case ScanCode.Digit9: return KeyCode.Digit9;
223
- case ScanCode.Digit0: return KeyCode.Digit0;
212
+ case 36 : return 22 ;
213
+ case 37 : return 23 ;
214
+ case 38 : return 24 ;
215
+ case 39 : return 25 ;
216
+ case 40 : return 26 ;
217
+ case 41 : return 27 ;
218
+ case 42 : return 28 ;
219
+ case 43 : return 29 ;
220
+ case 44 : return 30 ;
221
+ case 45 : return 21 ;
224
222
  }
225
223
  }
226
224
  const keyCodeCombos1 = this.lookupScanCodeCombo(( new ScanCodeCombo(false, false, false, scanCode)));
@@ -234,7 +232,7 @@ class ScanCodeKeyCodeMapper {
234
232
  return keyCode1;
235
233
  }
236
234
  }
237
- return KeyCode.DependsOnKbLayout;
235
+ return -1 ;
238
236
  }
239
237
  _encodeScanCodeCombo(scanCodeCombo) {
240
238
  return this._encode(scanCodeCombo.ctrlKey, scanCodeCombo.shiftKey, scanCodeCombo.altKey, scanCodeCombo.scanCode);
@@ -282,18 +280,18 @@ class MacLinuxKeyboardMapper {
282
280
  }
283
281
  }
284
282
  };
285
- for (let scanCode = ScanCode.None; scanCode < ScanCode.MAX_VALUE; scanCode++) {
283
+ for (let scanCode = 0 ; scanCode < 193 ; scanCode++) {
286
284
  this._scanCodeToLabel[scanCode] = null;
287
285
  }
288
- for (let scanCode = ScanCode.None; scanCode < ScanCode.MAX_VALUE; scanCode++) {
286
+ for (let scanCode = 0 ; scanCode < 193 ; scanCode++) {
289
287
  this._scanCodeToDispatch[scanCode] = null;
290
288
  }
291
- for (let scanCode = ScanCode.None; scanCode < ScanCode.MAX_VALUE; scanCode++) {
289
+ for (let scanCode = 0 ; scanCode < 193 ; scanCode++) {
292
290
  const keyCode = IMMUTABLE_CODE_TO_KEY_CODE[scanCode];
293
- if (keyCode !== KeyCode.DependsOnKbLayout) {
291
+ if (keyCode !== -1 ) {
294
292
  _registerAllCombos(0, 0, 0, scanCode, keyCode);
295
293
  this._scanCodeToLabel[scanCode] = ( KeyCodeUtils.toString(keyCode));
296
- if (keyCode === KeyCode.Unknown || keyCode === KeyCode.Ctrl || keyCode === KeyCode.Meta || keyCode === KeyCode.Alt || keyCode === KeyCode.Shift) {
294
+ if (keyCode === 0 || keyCode === 5 || keyCode === 57 || keyCode === 6 || keyCode === 4 ) {
297
295
  this._scanCodeToDispatch[scanCode] = null;
298
296
  }
299
297
  else {
@@ -307,16 +305,16 @@ class MacLinuxKeyboardMapper {
307
305
  for (const strScanCode in rawMappings) {
308
306
  if (rawMappings.hasOwnProperty(strScanCode)) {
309
307
  const scanCode = ScanCodeUtils.toEnum(strScanCode);
310
- if (scanCode === ScanCode.None) {
308
+ if (scanCode === 0 ) {
311
309
  continue;
312
310
  }
313
- if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== KeyCode.DependsOnKbLayout) {
311
+ if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== -1 ) {
314
312
  continue;
315
313
  }
316
314
  const rawMapping = rawMappings[strScanCode];
317
315
  const value = MacLinuxKeyboardMapper.getCharCode(rawMapping.value);
318
- if (value >= CharCode.a && value <= CharCode.z) {
319
- const upperCaseValue = CharCode.A + (value - CharCode.a);
316
+ if (value >= 97 && value <= 122 ) {
317
+ const upperCaseValue = 65 + ((value - 97) );
320
318
  producesLatinLetter[upperCaseValue] = true;
321
319
  }
322
320
  }
@@ -331,42 +329,42 @@ class MacLinuxKeyboardMapper {
331
329
  };
332
330
  }
333
331
  };
334
- _registerLetterIfMissing(CharCode.A, ScanCode.KeyA, 'a', 'A');
335
- _registerLetterIfMissing(CharCode.B, ScanCode.KeyB, 'b', 'B');
336
- _registerLetterIfMissing(CharCode.C, ScanCode.KeyC, 'c', 'C');
337
- _registerLetterIfMissing(CharCode.D, ScanCode.KeyD, 'd', 'D');
338
- _registerLetterIfMissing(CharCode.E, ScanCode.KeyE, 'e', 'E');
339
- _registerLetterIfMissing(CharCode.F, ScanCode.KeyF, 'f', 'F');
340
- _registerLetterIfMissing(CharCode.G, ScanCode.KeyG, 'g', 'G');
341
- _registerLetterIfMissing(CharCode.H, ScanCode.KeyH, 'h', 'H');
342
- _registerLetterIfMissing(CharCode.I, ScanCode.KeyI, 'i', 'I');
343
- _registerLetterIfMissing(CharCode.J, ScanCode.KeyJ, 'j', 'J');
344
- _registerLetterIfMissing(CharCode.K, ScanCode.KeyK, 'k', 'K');
345
- _registerLetterIfMissing(CharCode.L, ScanCode.KeyL, 'l', 'L');
346
- _registerLetterIfMissing(CharCode.M, ScanCode.KeyM, 'm', 'M');
347
- _registerLetterIfMissing(CharCode.N, ScanCode.KeyN, 'n', 'N');
348
- _registerLetterIfMissing(CharCode.O, ScanCode.KeyO, 'o', 'O');
349
- _registerLetterIfMissing(CharCode.P, ScanCode.KeyP, 'p', 'P');
350
- _registerLetterIfMissing(CharCode.Q, ScanCode.KeyQ, 'q', 'Q');
351
- _registerLetterIfMissing(CharCode.R, ScanCode.KeyR, 'r', 'R');
352
- _registerLetterIfMissing(CharCode.S, ScanCode.KeyS, 's', 'S');
353
- _registerLetterIfMissing(CharCode.T, ScanCode.KeyT, 't', 'T');
354
- _registerLetterIfMissing(CharCode.U, ScanCode.KeyU, 'u', 'U');
355
- _registerLetterIfMissing(CharCode.V, ScanCode.KeyV, 'v', 'V');
356
- _registerLetterIfMissing(CharCode.W, ScanCode.KeyW, 'w', 'W');
357
- _registerLetterIfMissing(CharCode.X, ScanCode.KeyX, 'x', 'X');
358
- _registerLetterIfMissing(CharCode.Y, ScanCode.KeyY, 'y', 'Y');
359
- _registerLetterIfMissing(CharCode.Z, ScanCode.KeyZ, 'z', 'Z');
332
+ _registerLetterIfMissing(65 , 10 , 'a', 'A');
333
+ _registerLetterIfMissing(66 , 11 , 'b', 'B');
334
+ _registerLetterIfMissing(67 , 12 , 'c', 'C');
335
+ _registerLetterIfMissing(68 , 13 , 'd', 'D');
336
+ _registerLetterIfMissing(69 , 14 , 'e', 'E');
337
+ _registerLetterIfMissing(70 , 15 , 'f', 'F');
338
+ _registerLetterIfMissing(71 , 16 , 'g', 'G');
339
+ _registerLetterIfMissing(72 , 17 , 'h', 'H');
340
+ _registerLetterIfMissing(73 , 18 , 'i', 'I');
341
+ _registerLetterIfMissing(74 , 19 , 'j', 'J');
342
+ _registerLetterIfMissing(75 , 20 , 'k', 'K');
343
+ _registerLetterIfMissing(76 , 21 , 'l', 'L');
344
+ _registerLetterIfMissing(77 , 22 , 'm', 'M');
345
+ _registerLetterIfMissing(78 , 23 , 'n', 'N');
346
+ _registerLetterIfMissing(79 , 24 , 'o', 'O');
347
+ _registerLetterIfMissing(80 , 25 , 'p', 'P');
348
+ _registerLetterIfMissing(81 , 26 , 'q', 'Q');
349
+ _registerLetterIfMissing(82 , 27 , 'r', 'R');
350
+ _registerLetterIfMissing(83 , 28 , 's', 'S');
351
+ _registerLetterIfMissing(84 , 29 , 't', 'T');
352
+ _registerLetterIfMissing(85 , 30 , 'u', 'U');
353
+ _registerLetterIfMissing(86 , 31 , 'v', 'V');
354
+ _registerLetterIfMissing(87 , 32 , 'w', 'W');
355
+ _registerLetterIfMissing(88 , 33 , 'x', 'X');
356
+ _registerLetterIfMissing(89 , 34 , 'y', 'Y');
357
+ _registerLetterIfMissing(90 , 35 , 'z', 'Z');
360
358
  }
361
359
  const mappings = [];
362
360
  let mappingsLen = 0;
363
361
  for (const strScanCode in rawMappings) {
364
362
  if (rawMappings.hasOwnProperty(strScanCode)) {
365
363
  const scanCode = ScanCodeUtils.toEnum(strScanCode);
366
- if (scanCode === ScanCode.None) {
364
+ if (scanCode === 0 ) {
367
365
  continue;
368
366
  }
369
- if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== KeyCode.DependsOnKbLayout) {
367
+ if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== -1 ) {
370
368
  continue;
371
369
  }
372
370
  this._codeInfo[scanCode] = rawMappings[strScanCode];
@@ -384,11 +382,11 @@ class MacLinuxKeyboardMapper {
384
382
  };
385
383
  mappings[mappingsLen++] = mapping;
386
384
  this._scanCodeToDispatch[scanCode] = `[${( ScanCodeUtils.toString(scanCode))}]`;
387
- if (value >= CharCode.a && value <= CharCode.z) {
388
- const upperCaseValue = CharCode.A + (value - CharCode.a);
385
+ if (value >= 97 && value <= 122 ) {
386
+ const upperCaseValue = 65 + ((value - 97) );
389
387
  this._scanCodeToLabel[scanCode] = String.fromCharCode(upperCaseValue);
390
388
  }
391
- else if (value >= CharCode.A && value <= CharCode.Z) {
389
+ else if (value >= 65 && value <= 90 ) {
392
390
  this._scanCodeToLabel[scanCode] = String.fromCharCode(value);
393
391
  }
394
392
  else if (value) {
@@ -495,29 +493,29 @@ class MacLinuxKeyboardMapper {
495
493
  _registerIfUnknown(1, 1, 1, scanCode, 1, 1, 1, keyCode);
496
494
  }
497
495
  }
498
- _registerAllCombos(0, 0, 0, ScanCode.Digit1, KeyCode.Digit1);
499
- _registerAllCombos(0, 0, 0, ScanCode.Digit2, KeyCode.Digit2);
500
- _registerAllCombos(0, 0, 0, ScanCode.Digit3, KeyCode.Digit3);
501
- _registerAllCombos(0, 0, 0, ScanCode.Digit4, KeyCode.Digit4);
502
- _registerAllCombos(0, 0, 0, ScanCode.Digit5, KeyCode.Digit5);
503
- _registerAllCombos(0, 0, 0, ScanCode.Digit6, KeyCode.Digit6);
504
- _registerAllCombos(0, 0, 0, ScanCode.Digit7, KeyCode.Digit7);
505
- _registerAllCombos(0, 0, 0, ScanCode.Digit8, KeyCode.Digit8);
506
- _registerAllCombos(0, 0, 0, ScanCode.Digit9, KeyCode.Digit9);
507
- _registerAllCombos(0, 0, 0, ScanCode.Digit0, KeyCode.Digit0);
496
+ _registerAllCombos(0, 0, 0, 36 , 22 );
497
+ _registerAllCombos(0, 0, 0, 37 , 23 );
498
+ _registerAllCombos(0, 0, 0, 38 , 24 );
499
+ _registerAllCombos(0, 0, 0, 39 , 25 );
500
+ _registerAllCombos(0, 0, 0, 40 , 26 );
501
+ _registerAllCombos(0, 0, 0, 41 , 27 );
502
+ _registerAllCombos(0, 0, 0, 42 , 28 );
503
+ _registerAllCombos(0, 0, 0, 43 , 29 );
504
+ _registerAllCombos(0, 0, 0, 44 , 30 );
505
+ _registerAllCombos(0, 0, 0, 45 , 21 );
508
506
  this._scanCodeKeyCodeMapper.registrationComplete();
509
507
  }
510
508
  dumpDebugInfo() {
511
509
  const result = [];
512
510
  const immutableSamples = [
513
- ScanCode.ArrowUp,
514
- ScanCode.Numpad0
511
+ 88 ,
512
+ 104
515
513
  ];
516
514
  let cnt = 0;
517
515
  result.push(`isUSStandard: ${this._isUSStandard}`);
518
516
  result.push(`----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------`);
519
- for (let scanCode = ScanCode.None; scanCode < ScanCode.MAX_VALUE; scanCode++) {
520
- if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== KeyCode.DependsOnKbLayout) {
517
+ for (let scanCode = 0 ; scanCode < 193 ; scanCode++) {
518
+ if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== -1 ) {
521
519
  if (immutableSamples.indexOf(scanCode) === -1) {
522
520
  continue;
523
521
  }
@@ -540,7 +538,7 @@ class MacLinuxKeyboardMapper {
540
538
  altKey: scanCodeCombo.altKey,
541
539
  metaKey: false,
542
540
  altGraphKey: false,
543
- keyCode: KeyCode.DependsOnKbLayout,
541
+ keyCode: -1 ,
544
542
  code: ( ScanCodeUtils.toString(scanCode))
545
543
  });
546
544
  const outScanCodeCombo = ( scanCodeCombo.toString());
@@ -598,8 +596,14 @@ class MacLinuxKeyboardMapper {
598
596
  return str;
599
597
  }
600
598
  keyCodeChordToScanCodeChord(chord) {
601
- if (chord.keyCode === KeyCode.Enter) {
602
- return [( new ScanCodeChord(chord.ctrlKey, chord.shiftKey, chord.altKey, chord.metaKey, ScanCode.Enter))];
599
+ if (chord.keyCode === 3 ) {
600
+ return [( new ScanCodeChord(
601
+ chord.ctrlKey,
602
+ chord.shiftKey,
603
+ chord.altKey,
604
+ chord.metaKey,
605
+ 46
606
+ ))];
603
607
  }
604
608
  const scanCodeCombos = this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(( new KeyCodeCombo(chord.ctrlKey, chord.shiftKey, chord.altKey, chord.keyCode)));
605
609
  const result = [];
@@ -622,15 +626,15 @@ class MacLinuxKeyboardMapper {
622
626
  if (chord.isDuplicateModifierCase()) {
623
627
  return '';
624
628
  }
625
- if (this._OS === OperatingSystem.Macintosh) {
629
+ if (this._OS === 2 ) {
626
630
  switch (chord.scanCode) {
627
- case ScanCode.ArrowLeft:
631
+ case 86 :
628
632
  return '←';
629
- case ScanCode.ArrowUp:
633
+ case 88 :
630
634
  return '↑';
631
- case ScanCode.ArrowRight:
635
+ case 85 :
632
636
  return '→';
633
- case ScanCode.ArrowDown:
637
+ case 87 :
634
638
  return '↓';
635
639
  }
636
640
  }
@@ -674,11 +678,11 @@ class MacLinuxKeyboardMapper {
674
678
  return '';
675
679
  }
676
680
  const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[chord.scanCode];
677
- if (immutableKeyCode !== KeyCode.DependsOnKbLayout) {
681
+ if (immutableKeyCode !== -1 ) {
678
682
  return KeyCodeUtils.toUserSettingsUS(immutableKeyCode).toLowerCase();
679
683
  }
680
684
  const constantKeyCode = this._scanCodeKeyCodeMapper.guessStableKeyCode(chord.scanCode);
681
- if (constantKeyCode !== KeyCode.DependsOnKbLayout) {
685
+ if (constantKeyCode !== -1 ) {
682
686
  const reverseChords = this.keyCodeChordToScanCodeChord(( new KeyCodeChord(
683
687
  chord.ctrlKey,
684
688
  chord.shiftKey,
@@ -700,26 +704,25 @@ class MacLinuxKeyboardMapper {
700
704
  return null;
701
705
  }
702
706
  const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[chord.scanCode];
703
- if (immutableKeyCode !== KeyCode.DependsOnKbLayout) {
707
+ if (immutableKeyCode !== -1 ) {
704
708
  return KeyCodeUtils.toElectronAccelerator(immutableKeyCode);
705
709
  }
706
710
  const constantKeyCode = this._scanCodeKeyCodeMapper.guessStableKeyCode(chord.scanCode);
707
- if (this._OS === OperatingSystem.Linux && !this._isUSStandard) {
708
- const isOEMKey = (constantKeyCode === KeyCode.Semicolon
709
- || constantKeyCode === KeyCode.Equal
710
- || constantKeyCode === KeyCode.Comma
711
- || constantKeyCode === KeyCode.Minus
712
- || constantKeyCode === KeyCode.Period
713
- || constantKeyCode === KeyCode.Slash
714
- || constantKeyCode === KeyCode.Backquote
715
- || constantKeyCode === KeyCode.BracketLeft
716
- || constantKeyCode === KeyCode.Backslash
717
- || constantKeyCode === KeyCode.BracketRight);
711
+ if (this._OS === 3 && !this._isUSStandard) {
712
+ const isOEMKey = ((constantKeyCode === 85
713
+ || constantKeyCode === 86
714
+ || constantKeyCode === 87
715
+ || constantKeyCode === 88
716
+ || constantKeyCode === 89
717
+ || constantKeyCode === 90
718
+ || constantKeyCode === 91
719
+ || constantKeyCode === 92
720
+ || constantKeyCode === 93 || constantKeyCode === 94) );
718
721
  if (isOEMKey) {
719
722
  return null;
720
723
  }
721
724
  }
722
- if (constantKeyCode !== KeyCode.DependsOnKbLayout) {
725
+ if (constantKeyCode !== -1 ) {
723
726
  return KeyCodeUtils.toElectronAccelerator(constantKeyCode);
724
727
  }
725
728
  return null;
@@ -747,41 +750,41 @@ class MacLinuxKeyboardMapper {
747
750
  }
748
751
  resolveKeyboardEvent(keyboardEvent) {
749
752
  let code = ScanCodeUtils.toEnum(keyboardEvent.code);
750
- if (code === ScanCode.NumpadEnter) {
751
- code = ScanCode.Enter;
753
+ if (code === 94 ) {
754
+ code = 46 ;
752
755
  }
753
756
  const keyCode = keyboardEvent.keyCode;
754
- if ((keyCode === KeyCode.LeftArrow)
755
- || (keyCode === KeyCode.UpArrow)
756
- || (keyCode === KeyCode.RightArrow)
757
- || (keyCode === KeyCode.DownArrow)
758
- || (keyCode === KeyCode.Delete)
759
- || (keyCode === KeyCode.Insert)
760
- || (keyCode === KeyCode.Home)
761
- || (keyCode === KeyCode.End)
762
- || (keyCode === KeyCode.PageDown)
763
- || (keyCode === KeyCode.PageUp)
764
- || (keyCode === KeyCode.Backspace)) {
757
+ if (((keyCode === 15) )
758
+ || ((keyCode === 16) )
759
+ || ((keyCode === 17) )
760
+ || ((keyCode === 18) )
761
+ || ((keyCode === 20) )
762
+ || ((keyCode === 19) )
763
+ || ((keyCode === 14) )
764
+ || ((keyCode === 13) )
765
+ || ((keyCode === 12) )
766
+ || ((keyCode === 11) )
767
+ || ((keyCode === 1) )) {
765
768
  const immutableScanCode = IMMUTABLE_KEY_CODE_TO_CODE[keyCode];
766
- if (immutableScanCode !== ScanCode.DependsOnKbLayout) {
769
+ if (immutableScanCode !== -1 ) {
767
770
  code = immutableScanCode;
768
771
  }
769
772
  }
770
773
  else {
771
- if ((code === ScanCode.Numpad1)
772
- || (code === ScanCode.Numpad2)
773
- || (code === ScanCode.Numpad3)
774
- || (code === ScanCode.Numpad4)
775
- || (code === ScanCode.Numpad5)
776
- || (code === ScanCode.Numpad6)
777
- || (code === ScanCode.Numpad7)
778
- || (code === ScanCode.Numpad8)
779
- || (code === ScanCode.Numpad9)
780
- || (code === ScanCode.Numpad0)
781
- || (code === ScanCode.NumpadDecimal)) {
774
+ if (((code === 95) )
775
+ || ((code === 96) )
776
+ || ((code === 97) )
777
+ || ((code === 98) )
778
+ || ((code === 99) )
779
+ || ((code === 100) )
780
+ || ((code === 101) )
781
+ || ((code === 102) )
782
+ || ((code === 103) )
783
+ || ((code === 104) )
784
+ || ((code === 105) )) {
782
785
  if (keyCode >= 0) {
783
786
  const immutableScanCode = IMMUTABLE_KEY_CODE_TO_CODE[keyCode];
784
- if (immutableScanCode !== ScanCode.DependsOnKbLayout) {
787
+ if (immutableScanCode !== -1 ) {
785
788
  code = immutableScanCode;
786
789
  }
787
790
  }
@@ -807,13 +810,13 @@ class MacLinuxKeyboardMapper {
807
810
  }
808
811
  static _redirectCharCode(charCode) {
809
812
  switch (charCode) {
810
- case CharCode.U_IDEOGRAPHIC_FULL_STOP: return CharCode.Period;
811
- case CharCode.U_LEFT_CORNER_BRACKET: return CharCode.OpenSquareBracket;
812
- case CharCode.U_RIGHT_CORNER_BRACKET: return CharCode.CloseSquareBracket;
813
- case CharCode.U_LEFT_BLACK_LENTICULAR_BRACKET: return CharCode.OpenSquareBracket;
814
- case CharCode.U_RIGHT_BLACK_LENTICULAR_BRACKET: return CharCode.CloseSquareBracket;
815
- case CharCode.U_FULLWIDTH_SEMICOLON: return CharCode.Semicolon;
816
- case CharCode.U_FULLWIDTH_COMMA: return CharCode.Comma;
813
+ case 12290 : return 46 ;
814
+ case 12300 : return 91 ;
815
+ case 12301 : return 93 ;
816
+ case 12304 : return 91 ;
817
+ case 12305 : return 93 ;
818
+ case 65307 : return 59 ;
819
+ case 65292 : return 44 ;
817
820
  }
818
821
  return charCode;
819
822
  }
@@ -830,17 +833,17 @@ class MacLinuxKeyboardMapper {
830
833
  }
831
834
  const charCode = char.charCodeAt(0);
832
835
  switch (charCode) {
833
- case CharCode.U_Combining_Grave_Accent: return CharCode.U_GRAVE_ACCENT;
834
- case CharCode.U_Combining_Acute_Accent: return CharCode.U_ACUTE_ACCENT;
835
- case CharCode.U_Combining_Circumflex_Accent: return CharCode.U_CIRCUMFLEX;
836
- case CharCode.U_Combining_Tilde: return CharCode.U_SMALL_TILDE;
837
- case CharCode.U_Combining_Macron: return CharCode.U_MACRON;
838
- case CharCode.U_Combining_Overline: return CharCode.U_OVERLINE;
839
- case CharCode.U_Combining_Breve: return CharCode.U_BREVE;
840
- case CharCode.U_Combining_Dot_Above: return CharCode.U_DOT_ABOVE;
841
- case CharCode.U_Combining_Diaeresis: return CharCode.U_DIAERESIS;
842
- case CharCode.U_Combining_Ring_Above: return CharCode.U_RING_ABOVE;
843
- case CharCode.U_Combining_Double_Acute_Accent: return CharCode.U_DOUBLE_ACUTE_ACCENT;
836
+ case 768 : return 96 ;
837
+ case 769 : return 180 ;
838
+ case 770 : return 94 ;
839
+ case 771 : return 732 ;
840
+ case 772 : return 175 ;
841
+ case 773 : return 8254 ;
842
+ case 774 : return 728 ;
843
+ case 775 : return 729 ;
844
+ case 776 : return 168 ;
845
+ case 778 : return 730 ;
846
+ case 779 : return 733 ;
844
847
  }
845
848
  return charCode;
846
849
  }
@@ -852,34 +855,34 @@ class MacLinuxKeyboardMapper {
852
855
  }
853
856
  CHAR_CODE_TO_KEY_CODE[charCode] = { keyCode: keyCode, shiftKey: shiftKey };
854
857
  }
855
- for (let chCode = CharCode.A; chCode <= CharCode.Z; chCode++) {
856
- define(chCode, KeyCode.KeyA + (chCode - CharCode.A), true);
857
- }
858
- for (let chCode = CharCode.a; chCode <= CharCode.z; chCode++) {
859
- define(chCode, KeyCode.KeyA + (chCode - CharCode.a), false);
860
- }
861
- define(CharCode.Semicolon, KeyCode.Semicolon, false);
862
- define(CharCode.Colon, KeyCode.Semicolon, true);
863
- define(CharCode.Equals, KeyCode.Equal, false);
864
- define(CharCode.Plus, KeyCode.Equal, true);
865
- define(CharCode.Comma, KeyCode.Comma, false);
866
- define(CharCode.LessThan, KeyCode.Comma, true);
867
- define(CharCode.Dash, KeyCode.Minus, false);
868
- define(CharCode.Underline, KeyCode.Minus, true);
869
- define(CharCode.Period, KeyCode.Period, false);
870
- define(CharCode.GreaterThan, KeyCode.Period, true);
871
- define(CharCode.Slash, KeyCode.Slash, false);
872
- define(CharCode.QuestionMark, KeyCode.Slash, true);
873
- define(CharCode.BackTick, KeyCode.Backquote, false);
874
- define(CharCode.Tilde, KeyCode.Backquote, true);
875
- define(CharCode.OpenSquareBracket, KeyCode.BracketLeft, false);
876
- define(CharCode.OpenCurlyBrace, KeyCode.BracketLeft, true);
877
- define(CharCode.Backslash, KeyCode.Backslash, false);
878
- define(CharCode.Pipe, KeyCode.Backslash, true);
879
- define(CharCode.CloseSquareBracket, KeyCode.BracketRight, false);
880
- define(CharCode.CloseCurlyBrace, KeyCode.BracketRight, true);
881
- define(CharCode.SingleQuote, KeyCode.Quote, false);
882
- define(CharCode.DoubleQuote, KeyCode.Quote, true);
858
+ for (let chCode = 65 ; chCode <= 90 ; chCode++) {
859
+ define(chCode, 31 + ((chCode - 65) ), true);
860
+ }
861
+ for (let chCode = 97 ; chCode <= 122 ; chCode++) {
862
+ define(chCode, 31 + ((chCode - 97) ), false);
863
+ }
864
+ define(59 , 85 , false);
865
+ define(58 , 85 , true);
866
+ define(61 , 86 , false);
867
+ define(43 , 86 , true);
868
+ define(44 , 87 , false);
869
+ define(60 , 87 , true);
870
+ define(45 , 88 , false);
871
+ define(95 , 88 , true);
872
+ define(46 , 89 , false);
873
+ define(62 , 89 , true);
874
+ define(47 , 90 , false);
875
+ define(63 , 90 , true);
876
+ define(96 , 91 , false);
877
+ define(126 , 91 , true);
878
+ define(91 , 92 , false);
879
+ define(123 , 92 , true);
880
+ define(92 , 93 , false);
881
+ define(124 , 93 , true);
882
+ define(93 , 94 , false);
883
+ define(125 , 94 , true);
884
+ define(39 , 95 , false);
885
+ define(34 , 95 , true);
883
886
  })();
884
887
 
885
888
  export { MacLinuxKeyboardMapper, NativeResolvedKeybinding };