@codingame/monaco-vscode-keybindings-service-override 25.1.2 → 26.0.1
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.
- package/package.json +3 -3
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +20 -17
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +45 -56
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +25 -17
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +39 -36
- package/vscode/src/vs/workbench/contrib/preferences/common/smartSnippetInserter.js +37 -40
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +678 -724
- package/vscode/src/vs/workbench/services/commands/common/commandService.js +13 -17
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +245 -208
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +64 -71
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution.js +3 -1
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.js +20 -25
- package/vscode/src/vs/workbench/services/keybinding/common/keymapInfo.js +21 -22
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +185 -173
- package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.js +49 -45
|
@@ -45,16 +45,16 @@ class NativeResolvedKeybinding extends BaseResolvedKeybinding {
|
|
|
45
45
|
}
|
|
46
46
|
_getSingleModifierChordDispatch(chord) {
|
|
47
47
|
if ((chord.scanCode === ScanCode.ControlLeft || chord.scanCode === ScanCode.ControlRight) && !chord.shiftKey && !chord.altKey && !chord.metaKey) {
|
|
48
|
-
return
|
|
48
|
+
return "ctrl";
|
|
49
49
|
}
|
|
50
50
|
if ((chord.scanCode === ScanCode.AltLeft || chord.scanCode === ScanCode.AltRight) && !chord.ctrlKey && !chord.shiftKey && !chord.metaKey) {
|
|
51
|
-
return
|
|
51
|
+
return "alt";
|
|
52
52
|
}
|
|
53
53
|
if ((chord.scanCode === ScanCode.ShiftLeft || chord.scanCode === ScanCode.ShiftRight) && !chord.ctrlKey && !chord.altKey && !chord.metaKey) {
|
|
54
|
-
return
|
|
54
|
+
return "shift";
|
|
55
55
|
}
|
|
56
56
|
if ((chord.scanCode === ScanCode.MetaLeft || chord.scanCode === ScanCode.MetaRight) && !chord.ctrlKey && !chord.shiftKey && !chord.altKey) {
|
|
57
|
-
return
|
|
57
|
+
return "meta";
|
|
58
58
|
}
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
@@ -67,17 +67,14 @@ class ScanCodeCombo {
|
|
|
67
67
|
this.scanCode = scanCode;
|
|
68
68
|
}
|
|
69
69
|
toString() {
|
|
70
|
-
return `${this.ctrlKey ?
|
|
70
|
+
return `${this.ctrlKey ? "Ctrl+" : ""}${this.shiftKey ? "Shift+" : ""}${this.altKey ? "Alt+" : ""}${( ScanCodeUtils.toString(this.scanCode))}`;
|
|
71
71
|
}
|
|
72
72
|
equals(other) {
|
|
73
|
-
return (this.ctrlKey === other.ctrlKey
|
|
74
|
-
&& this.shiftKey === other.shiftKey
|
|
75
|
-
&& this.altKey === other.altKey
|
|
76
|
-
&& this.scanCode === other.scanCode);
|
|
73
|
+
return (this.ctrlKey === other.ctrlKey && this.shiftKey === other.shiftKey && this.altKey === other.altKey && this.scanCode === other.scanCode);
|
|
77
74
|
}
|
|
78
75
|
getProducedCharCode(mapping) {
|
|
79
76
|
if (!mapping) {
|
|
80
|
-
return
|
|
77
|
+
return "";
|
|
81
78
|
}
|
|
82
79
|
if (this.ctrlKey && this.shiftKey && this.altKey) {
|
|
83
80
|
return mapping.withShiftAltGr;
|
|
@@ -93,12 +90,12 @@ class ScanCodeCombo {
|
|
|
93
90
|
getProducedChar(mapping) {
|
|
94
91
|
const charCode = MacLinuxKeyboardMapper.getCharCode(this.getProducedCharCode(mapping));
|
|
95
92
|
if (charCode === 0) {
|
|
96
|
-
return
|
|
93
|
+
return " --- ";
|
|
97
94
|
}
|
|
98
95
|
if (charCode >= CharCode.U_Combining_Grave_Accent && charCode <= CharCode.U_Combining_Latin_Small_Letter_X) {
|
|
99
|
-
return
|
|
96
|
+
return "U+" + ( charCode.toString(16));
|
|
100
97
|
}
|
|
101
|
-
return
|
|
98
|
+
return " " + String.fromCharCode(charCode) + " ";
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
class KeyCodeCombo {
|
|
@@ -109,7 +106,7 @@ class KeyCodeCombo {
|
|
|
109
106
|
this.keyCode = keyCode;
|
|
110
107
|
}
|
|
111
108
|
toString() {
|
|
112
|
-
return `${this.ctrlKey ?
|
|
109
|
+
return `${this.ctrlKey ? "Ctrl+" : ""}${this.shiftKey ? "Shift+" : ""}${this.altKey ? "Alt+" : ""}${( KeyCodeUtils.toString(this.keyCode))}`;
|
|
113
110
|
}
|
|
114
111
|
}
|
|
115
112
|
class ScanCodeKeyCodeMapper {
|
|
@@ -164,8 +161,7 @@ class ScanCodeKeyCodeMapper {
|
|
|
164
161
|
}
|
|
165
162
|
}
|
|
166
163
|
}
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
164
|
+
} else {
|
|
169
165
|
if (existingKeyCodeCombos && existingKeyCodeCombos.length !== 0) {
|
|
170
166
|
return;
|
|
171
167
|
}
|
|
@@ -212,16 +208,26 @@ class ScanCodeKeyCodeMapper {
|
|
|
212
208
|
guessStableKeyCode(scanCode) {
|
|
213
209
|
if (scanCode >= ScanCode.Digit1 && scanCode <= ScanCode.Digit0) {
|
|
214
210
|
switch (scanCode) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
211
|
+
case ScanCode.Digit1:
|
|
212
|
+
return KeyCode.Digit1;
|
|
213
|
+
case ScanCode.Digit2:
|
|
214
|
+
return KeyCode.Digit2;
|
|
215
|
+
case ScanCode.Digit3:
|
|
216
|
+
return KeyCode.Digit3;
|
|
217
|
+
case ScanCode.Digit4:
|
|
218
|
+
return KeyCode.Digit4;
|
|
219
|
+
case ScanCode.Digit5:
|
|
220
|
+
return KeyCode.Digit5;
|
|
221
|
+
case ScanCode.Digit6:
|
|
222
|
+
return KeyCode.Digit6;
|
|
223
|
+
case ScanCode.Digit7:
|
|
224
|
+
return KeyCode.Digit7;
|
|
225
|
+
case ScanCode.Digit8:
|
|
226
|
+
return KeyCode.Digit8;
|
|
227
|
+
case ScanCode.Digit9:
|
|
228
|
+
return KeyCode.Digit9;
|
|
229
|
+
case ScanCode.Digit0:
|
|
230
|
+
return KeyCode.Digit0;
|
|
225
231
|
}
|
|
226
232
|
}
|
|
227
233
|
const keyCodeCombos1 = this.lookupScanCodeCombo(( new ScanCodeCombo(false, false, false, scanCode)));
|
|
@@ -238,16 +244,23 @@ class ScanCodeKeyCodeMapper {
|
|
|
238
244
|
return KeyCode.DependsOnKbLayout;
|
|
239
245
|
}
|
|
240
246
|
_encodeScanCodeCombo(scanCodeCombo) {
|
|
241
|
-
return this._encode(
|
|
247
|
+
return this._encode(
|
|
248
|
+
scanCodeCombo.ctrlKey,
|
|
249
|
+
scanCodeCombo.shiftKey,
|
|
250
|
+
scanCodeCombo.altKey,
|
|
251
|
+
scanCodeCombo.scanCode
|
|
252
|
+
);
|
|
242
253
|
}
|
|
243
254
|
_encodeKeyCodeCombo(keyCodeCombo) {
|
|
244
|
-
return this._encode(
|
|
255
|
+
return this._encode(
|
|
256
|
+
keyCodeCombo.ctrlKey,
|
|
257
|
+
keyCodeCombo.shiftKey,
|
|
258
|
+
keyCodeCombo.altKey,
|
|
259
|
+
keyCodeCombo.keyCode
|
|
260
|
+
);
|
|
245
261
|
}
|
|
246
262
|
_encode(ctrlKey, shiftKey, altKey, principal) {
|
|
247
|
-
return (((ctrlKey ? 1 : 0) << 0)
|
|
248
|
-
| ((shiftKey ? 1 : 0) << 1)
|
|
249
|
-
| ((altKey ? 1 : 0) << 2)
|
|
250
|
-
| principal << 3) >>> 0;
|
|
263
|
+
return (((ctrlKey ? 1 : 0) << 0) | ((shiftKey ? 1 : 0) << 1) | ((altKey ? 1 : 0) << 2) | principal << 3) >>> 0;
|
|
251
264
|
}
|
|
252
265
|
}
|
|
253
266
|
class MacLinuxKeyboardMapper {
|
|
@@ -261,7 +274,16 @@ class MacLinuxKeyboardMapper {
|
|
|
261
274
|
this._scanCodeKeyCodeMapper = ( new ScanCodeKeyCodeMapper());
|
|
262
275
|
this._scanCodeToLabel = [];
|
|
263
276
|
this._scanCodeToDispatch = [];
|
|
264
|
-
const _registerIfUnknown = (
|
|
277
|
+
const _registerIfUnknown = (
|
|
278
|
+
hwCtrlKey,
|
|
279
|
+
hwShiftKey,
|
|
280
|
+
hwAltKey,
|
|
281
|
+
scanCode,
|
|
282
|
+
kbCtrlKey,
|
|
283
|
+
kbShiftKey,
|
|
284
|
+
kbAltKey,
|
|
285
|
+
keyCode
|
|
286
|
+
) => {
|
|
265
287
|
this._scanCodeKeyCodeMapper.registerIfUnknown(( new ScanCodeCombo(
|
|
266
288
|
hwCtrlKey ? true : false,
|
|
267
289
|
hwShiftKey ? true : false,
|
|
@@ -296,8 +318,7 @@ class MacLinuxKeyboardMapper {
|
|
|
296
318
|
this._scanCodeToLabel[scanCode] = ( KeyCodeUtils.toString(keyCode));
|
|
297
319
|
if (keyCode === KeyCode.Unknown || isModifierKey(keyCode)) {
|
|
298
320
|
this._scanCodeToDispatch[scanCode] = null;
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
321
|
+
} else {
|
|
301
322
|
this._scanCodeToDispatch[scanCode] = `[${( ScanCodeUtils.toString(scanCode))}]`;
|
|
302
323
|
}
|
|
303
324
|
}
|
|
@@ -327,37 +348,37 @@ class MacLinuxKeyboardMapper {
|
|
|
327
348
|
missingLatinLettersOverride[( ScanCodeUtils.toString(scanCode))] = {
|
|
328
349
|
value: value,
|
|
329
350
|
withShift: withShift,
|
|
330
|
-
withAltGr:
|
|
331
|
-
withShiftAltGr:
|
|
351
|
+
withAltGr: "",
|
|
352
|
+
withShiftAltGr: ""
|
|
332
353
|
};
|
|
333
354
|
}
|
|
334
355
|
};
|
|
335
|
-
_registerLetterIfMissing(CharCode.A, ScanCode.KeyA,
|
|
336
|
-
_registerLetterIfMissing(CharCode.B, ScanCode.KeyB,
|
|
337
|
-
_registerLetterIfMissing(CharCode.C, ScanCode.KeyC,
|
|
338
|
-
_registerLetterIfMissing(CharCode.D, ScanCode.KeyD,
|
|
339
|
-
_registerLetterIfMissing(CharCode.E, ScanCode.KeyE,
|
|
340
|
-
_registerLetterIfMissing(CharCode.F, ScanCode.KeyF,
|
|
341
|
-
_registerLetterIfMissing(CharCode.G, ScanCode.KeyG,
|
|
342
|
-
_registerLetterIfMissing(CharCode.H, ScanCode.KeyH,
|
|
343
|
-
_registerLetterIfMissing(CharCode.I, ScanCode.KeyI,
|
|
344
|
-
_registerLetterIfMissing(CharCode.J, ScanCode.KeyJ,
|
|
345
|
-
_registerLetterIfMissing(CharCode.K, ScanCode.KeyK,
|
|
346
|
-
_registerLetterIfMissing(CharCode.L, ScanCode.KeyL,
|
|
347
|
-
_registerLetterIfMissing(CharCode.M, ScanCode.KeyM,
|
|
348
|
-
_registerLetterIfMissing(CharCode.N, ScanCode.KeyN,
|
|
349
|
-
_registerLetterIfMissing(CharCode.O, ScanCode.KeyO,
|
|
350
|
-
_registerLetterIfMissing(CharCode.P, ScanCode.KeyP,
|
|
351
|
-
_registerLetterIfMissing(CharCode.Q, ScanCode.KeyQ,
|
|
352
|
-
_registerLetterIfMissing(CharCode.R, ScanCode.KeyR,
|
|
353
|
-
_registerLetterIfMissing(CharCode.S, ScanCode.KeyS,
|
|
354
|
-
_registerLetterIfMissing(CharCode.T, ScanCode.KeyT,
|
|
355
|
-
_registerLetterIfMissing(CharCode.U, ScanCode.KeyU,
|
|
356
|
-
_registerLetterIfMissing(CharCode.V, ScanCode.KeyV,
|
|
357
|
-
_registerLetterIfMissing(CharCode.W, ScanCode.KeyW,
|
|
358
|
-
_registerLetterIfMissing(CharCode.X, ScanCode.KeyX,
|
|
359
|
-
_registerLetterIfMissing(CharCode.Y, ScanCode.KeyY,
|
|
360
|
-
_registerLetterIfMissing(CharCode.Z, ScanCode.KeyZ,
|
|
356
|
+
_registerLetterIfMissing(CharCode.A, ScanCode.KeyA, "a", "A");
|
|
357
|
+
_registerLetterIfMissing(CharCode.B, ScanCode.KeyB, "b", "B");
|
|
358
|
+
_registerLetterIfMissing(CharCode.C, ScanCode.KeyC, "c", "C");
|
|
359
|
+
_registerLetterIfMissing(CharCode.D, ScanCode.KeyD, "d", "D");
|
|
360
|
+
_registerLetterIfMissing(CharCode.E, ScanCode.KeyE, "e", "E");
|
|
361
|
+
_registerLetterIfMissing(CharCode.F, ScanCode.KeyF, "f", "F");
|
|
362
|
+
_registerLetterIfMissing(CharCode.G, ScanCode.KeyG, "g", "G");
|
|
363
|
+
_registerLetterIfMissing(CharCode.H, ScanCode.KeyH, "h", "H");
|
|
364
|
+
_registerLetterIfMissing(CharCode.I, ScanCode.KeyI, "i", "I");
|
|
365
|
+
_registerLetterIfMissing(CharCode.J, ScanCode.KeyJ, "j", "J");
|
|
366
|
+
_registerLetterIfMissing(CharCode.K, ScanCode.KeyK, "k", "K");
|
|
367
|
+
_registerLetterIfMissing(CharCode.L, ScanCode.KeyL, "l", "L");
|
|
368
|
+
_registerLetterIfMissing(CharCode.M, ScanCode.KeyM, "m", "M");
|
|
369
|
+
_registerLetterIfMissing(CharCode.N, ScanCode.KeyN, "n", "N");
|
|
370
|
+
_registerLetterIfMissing(CharCode.O, ScanCode.KeyO, "o", "O");
|
|
371
|
+
_registerLetterIfMissing(CharCode.P, ScanCode.KeyP, "p", "P");
|
|
372
|
+
_registerLetterIfMissing(CharCode.Q, ScanCode.KeyQ, "q", "Q");
|
|
373
|
+
_registerLetterIfMissing(CharCode.R, ScanCode.KeyR, "r", "R");
|
|
374
|
+
_registerLetterIfMissing(CharCode.S, ScanCode.KeyS, "s", "S");
|
|
375
|
+
_registerLetterIfMissing(CharCode.T, ScanCode.KeyT, "t", "T");
|
|
376
|
+
_registerLetterIfMissing(CharCode.U, ScanCode.KeyU, "u", "U");
|
|
377
|
+
_registerLetterIfMissing(CharCode.V, ScanCode.KeyV, "v", "V");
|
|
378
|
+
_registerLetterIfMissing(CharCode.W, ScanCode.KeyW, "w", "W");
|
|
379
|
+
_registerLetterIfMissing(CharCode.X, ScanCode.KeyX, "x", "X");
|
|
380
|
+
_registerLetterIfMissing(CharCode.Y, ScanCode.KeyY, "y", "Y");
|
|
381
|
+
_registerLetterIfMissing(CharCode.Z, ScanCode.KeyZ, "z", "Z");
|
|
361
382
|
}
|
|
362
383
|
const mappings = [];
|
|
363
384
|
let mappingsLen = 0;
|
|
@@ -381,21 +402,18 @@ class MacLinuxKeyboardMapper {
|
|
|
381
402
|
value: value,
|
|
382
403
|
withShift: withShift,
|
|
383
404
|
withAltGr: withAltGr,
|
|
384
|
-
withShiftAltGr: withShiftAltGr
|
|
405
|
+
withShiftAltGr: withShiftAltGr
|
|
385
406
|
};
|
|
386
407
|
mappings[mappingsLen++] = mapping;
|
|
387
408
|
this._scanCodeToDispatch[scanCode] = `[${( ScanCodeUtils.toString(scanCode))}]`;
|
|
388
409
|
if (value >= CharCode.a && value <= CharCode.z) {
|
|
389
410
|
const upperCaseValue = CharCode.A + (value - CharCode.a);
|
|
390
411
|
this._scanCodeToLabel[scanCode] = String.fromCharCode(upperCaseValue);
|
|
391
|
-
}
|
|
392
|
-
else if (value >= CharCode.A && value <= CharCode.Z) {
|
|
412
|
+
} else if (value >= CharCode.A && value <= CharCode.Z) {
|
|
393
413
|
this._scanCodeToLabel[scanCode] = String.fromCharCode(value);
|
|
394
|
-
}
|
|
395
|
-
else if (value) {
|
|
414
|
+
} else if (value) {
|
|
396
415
|
this._scanCodeToLabel[scanCode] = String.fromCharCode(value);
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
416
|
+
} else {
|
|
399
417
|
this._scanCodeToLabel[scanCode] = null;
|
|
400
418
|
}
|
|
401
419
|
}
|
|
@@ -415,8 +433,7 @@ class MacLinuxKeyboardMapper {
|
|
|
415
433
|
const keyCode = kb.keyCode;
|
|
416
434
|
if (kbShiftKey) {
|
|
417
435
|
_registerIfUnknown(1, 1, 1, scanCode, 0, 1, 0, keyCode);
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
436
|
+
} else {
|
|
420
437
|
_registerIfUnknown(1, 1, 1, scanCode, 0, 0, 0, keyCode);
|
|
421
438
|
}
|
|
422
439
|
}
|
|
@@ -435,8 +452,7 @@ class MacLinuxKeyboardMapper {
|
|
|
435
452
|
const keyCode = kb.keyCode;
|
|
436
453
|
if (kbShiftKey) {
|
|
437
454
|
_registerIfUnknown(1, 0, 1, scanCode, 0, 1, 0, keyCode);
|
|
438
|
-
}
|
|
439
|
-
else {
|
|
455
|
+
} else {
|
|
440
456
|
_registerIfUnknown(1, 0, 1, scanCode, 0, 0, 0, keyCode);
|
|
441
457
|
}
|
|
442
458
|
}
|
|
@@ -458,8 +474,7 @@ class MacLinuxKeyboardMapper {
|
|
|
458
474
|
_registerIfUnknown(0, 1, 1, scanCode, 0, 1, 1, keyCode);
|
|
459
475
|
_registerIfUnknown(1, 1, 0, scanCode, 1, 1, 0, keyCode);
|
|
460
476
|
_registerIfUnknown(1, 1, 1, scanCode, 1, 1, 1, keyCode);
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
477
|
+
} else {
|
|
463
478
|
_registerIfUnknown(0, 1, 0, scanCode, 0, 0, 0, keyCode);
|
|
464
479
|
_registerIfUnknown(0, 1, 0, scanCode, 0, 1, 0, keyCode);
|
|
465
480
|
_registerIfUnknown(0, 1, 1, scanCode, 0, 0, 1, keyCode);
|
|
@@ -484,8 +499,7 @@ class MacLinuxKeyboardMapper {
|
|
|
484
499
|
_registerIfUnknown(0, 0, 1, scanCode, 0, 1, 1, keyCode);
|
|
485
500
|
_registerIfUnknown(1, 0, 0, scanCode, 1, 1, 0, keyCode);
|
|
486
501
|
_registerIfUnknown(1, 0, 1, scanCode, 1, 1, 1, keyCode);
|
|
487
|
-
}
|
|
488
|
-
else {
|
|
502
|
+
} else {
|
|
489
503
|
_registerIfUnknown(0, 0, 0, scanCode, 0, 0, 0, keyCode);
|
|
490
504
|
_registerIfUnknown(0, 0, 1, scanCode, 0, 0, 1, keyCode);
|
|
491
505
|
_registerIfUnknown(0, 1, 0, scanCode, 0, 1, 0, keyCode);
|
|
@@ -510,13 +524,12 @@ class MacLinuxKeyboardMapper {
|
|
|
510
524
|
}
|
|
511
525
|
dumpDebugInfo() {
|
|
512
526
|
const result = [];
|
|
513
|
-
const immutableSamples = [
|
|
514
|
-
ScanCode.ArrowUp,
|
|
515
|
-
ScanCode.Numpad0
|
|
516
|
-
];
|
|
527
|
+
const immutableSamples = [ScanCode.ArrowUp, ScanCode.Numpad0];
|
|
517
528
|
let cnt = 0;
|
|
518
529
|
result.push(`isUSStandard: ${this._isUSStandard}`);
|
|
519
|
-
result.push(
|
|
530
|
+
result.push(
|
|
531
|
+
`----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------`
|
|
532
|
+
);
|
|
520
533
|
for (let scanCode = ScanCode.None; scanCode < ScanCode.MAX_VALUE; scanCode++) {
|
|
521
534
|
if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== KeyCode.DependsOnKbLayout) {
|
|
522
535
|
if (immutableSamples.indexOf(scanCode) === -1) {
|
|
@@ -524,8 +537,12 @@ class MacLinuxKeyboardMapper {
|
|
|
524
537
|
}
|
|
525
538
|
}
|
|
526
539
|
if (cnt % 4 === 0) {
|
|
527
|
-
result.push(
|
|
528
|
-
|
|
540
|
+
result.push(
|
|
541
|
+
`| HW Code combination | Key | KeyCode combination | Pri | UI label | User settings | Electron accelerator | Dispatching string | WYSIWYG |`
|
|
542
|
+
);
|
|
543
|
+
result.push(
|
|
544
|
+
`----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------`
|
|
545
|
+
);
|
|
529
546
|
}
|
|
530
547
|
cnt++;
|
|
531
548
|
const mapping = this._codeInfo[scanCode];
|
|
@@ -547,25 +564,25 @@ class MacLinuxKeyboardMapper {
|
|
|
547
564
|
const outScanCodeCombo = ( scanCodeCombo.toString());
|
|
548
565
|
const outKey = scanCodeCombo.getProducedChar(mapping);
|
|
549
566
|
const ariaLabel = resolvedKb.getAriaLabel();
|
|
550
|
-
const outUILabel = (ariaLabel ? ariaLabel.replace(/Control\+/,
|
|
567
|
+
const outUILabel = (ariaLabel ? ariaLabel.replace(/Control\+/, "Ctrl+") : null);
|
|
551
568
|
const outUserSettings = resolvedKb.getUserSettingsLabel();
|
|
552
569
|
const outElectronAccelerator = resolvedKb.getElectronAccelerator();
|
|
553
570
|
const outDispatchStr = resolvedKb.getDispatchChords()[0];
|
|
554
571
|
const isWYSIWYG = (resolvedKb ? resolvedKb.isWYSIWYG() : false);
|
|
555
|
-
const outWYSIWYG = (isWYSIWYG ?
|
|
572
|
+
const outWYSIWYG = (isWYSIWYG ? " " : " NO ");
|
|
556
573
|
const kbCombos = this._scanCodeKeyCodeMapper.lookupScanCodeCombo(scanCodeCombo);
|
|
557
574
|
if (kbCombos.length === 0) {
|
|
558
|
-
result.push(
|
|
559
|
-
|
|
560
|
-
|
|
575
|
+
result.push(
|
|
576
|
+
`| ${this._leftPad(outScanCodeCombo, 30)} | ${outKey} | ${this._leftPad("", 25)} | ${this._leftPad("", 3)} | ${this._leftPad(outUILabel, 25)} | ${this._leftPad(outUserSettings, 30)} | ${this._leftPad(outElectronAccelerator, 25)} | ${this._leftPad(outDispatchStr, 30)} | ${outWYSIWYG} |`
|
|
577
|
+
);
|
|
578
|
+
} else {
|
|
561
579
|
for (let i = 0, len = kbCombos.length; i < len; i++) {
|
|
562
580
|
const kbCombo = kbCombos[i];
|
|
563
581
|
let colPriority;
|
|
564
582
|
const scanCodeCombos = this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(kbCombo);
|
|
565
583
|
if (scanCodeCombos.length === 1) {
|
|
566
|
-
colPriority =
|
|
567
|
-
}
|
|
568
|
-
else {
|
|
584
|
+
colPriority = "";
|
|
585
|
+
} else {
|
|
569
586
|
let priority = -1;
|
|
570
587
|
for (let j = 0; j < scanCodeCombos.length; j++) {
|
|
571
588
|
if (scanCodeCombos[j].equals(scanCodeCombo)) {
|
|
@@ -577,24 +594,29 @@ class MacLinuxKeyboardMapper {
|
|
|
577
594
|
}
|
|
578
595
|
const outKeybinding = ( kbCombo.toString());
|
|
579
596
|
if (i === 0) {
|
|
580
|
-
result.push(
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
597
|
+
result.push(
|
|
598
|
+
`| ${this._leftPad(outScanCodeCombo, 30)} | ${outKey} | ${this._leftPad(outKeybinding, 25)} | ${this._leftPad(colPriority, 3)} | ${this._leftPad(outUILabel, 25)} | ${this._leftPad(outUserSettings, 30)} | ${this._leftPad(outElectronAccelerator, 25)} | ${this._leftPad(outDispatchStr, 30)} | ${outWYSIWYG} |`
|
|
599
|
+
);
|
|
600
|
+
} else {
|
|
601
|
+
result.push(
|
|
602
|
+
`| ${this._leftPad("", 30)} | | ${this._leftPad(outKeybinding, 25)} | ${this._leftPad(colPriority, 3)} | ${this._leftPad("", 25)} | ${this._leftPad("", 30)} | ${this._leftPad("", 25)} | ${this._leftPad("", 30)} | |`
|
|
603
|
+
);
|
|
584
604
|
}
|
|
585
605
|
}
|
|
586
606
|
}
|
|
587
607
|
}
|
|
588
|
-
result.push(
|
|
608
|
+
result.push(
|
|
609
|
+
`----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------`
|
|
610
|
+
);
|
|
589
611
|
}
|
|
590
|
-
return result.join(
|
|
612
|
+
return result.join("\n");
|
|
591
613
|
}
|
|
592
614
|
_leftPad(str, cnt) {
|
|
593
615
|
if (str === null) {
|
|
594
|
-
str =
|
|
616
|
+
str = "null";
|
|
595
617
|
}
|
|
596
618
|
while (str.length < cnt) {
|
|
597
|
-
str =
|
|
619
|
+
str = " " + str;
|
|
598
620
|
}
|
|
599
621
|
return str;
|
|
600
622
|
}
|
|
@@ -621,18 +643,18 @@ class MacLinuxKeyboardMapper {
|
|
|
621
643
|
return null;
|
|
622
644
|
}
|
|
623
645
|
if (chord.isDuplicateModifierCase()) {
|
|
624
|
-
return
|
|
646
|
+
return "";
|
|
625
647
|
}
|
|
626
648
|
if (this._OS === OperatingSystem.Macintosh) {
|
|
627
649
|
switch (chord.scanCode) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
650
|
+
case ScanCode.ArrowLeft:
|
|
651
|
+
return "←";
|
|
652
|
+
case ScanCode.ArrowUp:
|
|
653
|
+
return "↑";
|
|
654
|
+
case ScanCode.ArrowRight:
|
|
655
|
+
return "→";
|
|
656
|
+
case ScanCode.ArrowDown:
|
|
657
|
+
return "↓";
|
|
636
658
|
}
|
|
637
659
|
}
|
|
638
660
|
return this._scanCodeToLabel[chord.scanCode];
|
|
@@ -642,7 +664,7 @@ class MacLinuxKeyboardMapper {
|
|
|
642
664
|
return null;
|
|
643
665
|
}
|
|
644
666
|
if (chord.isDuplicateModifierCase()) {
|
|
645
|
-
return
|
|
667
|
+
return "";
|
|
646
668
|
}
|
|
647
669
|
return this._scanCodeToLabel[chord.scanCode];
|
|
648
670
|
}
|
|
@@ -651,18 +673,18 @@ class MacLinuxKeyboardMapper {
|
|
|
651
673
|
if (!codeDispatch) {
|
|
652
674
|
return null;
|
|
653
675
|
}
|
|
654
|
-
let result =
|
|
676
|
+
let result = "";
|
|
655
677
|
if (chord.ctrlKey) {
|
|
656
|
-
result +=
|
|
678
|
+
result += "ctrl+";
|
|
657
679
|
}
|
|
658
680
|
if (chord.shiftKey) {
|
|
659
|
-
result +=
|
|
681
|
+
result += "shift+";
|
|
660
682
|
}
|
|
661
683
|
if (chord.altKey) {
|
|
662
|
-
result +=
|
|
684
|
+
result += "alt+";
|
|
663
685
|
}
|
|
664
686
|
if (chord.metaKey) {
|
|
665
|
-
result +=
|
|
687
|
+
result += "meta+";
|
|
666
688
|
}
|
|
667
689
|
result += codeDispatch;
|
|
668
690
|
return result;
|
|
@@ -672,7 +694,7 @@ class MacLinuxKeyboardMapper {
|
|
|
672
694
|
return null;
|
|
673
695
|
}
|
|
674
696
|
if (chord.isDuplicateModifierCase()) {
|
|
675
|
-
return
|
|
697
|
+
return "";
|
|
676
698
|
}
|
|
677
699
|
const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[chord.scanCode];
|
|
678
700
|
if (immutableKeyCode !== KeyCode.DependsOnKbLayout) {
|
|
@@ -706,16 +728,7 @@ class MacLinuxKeyboardMapper {
|
|
|
706
728
|
}
|
|
707
729
|
const constantKeyCode = this._scanCodeKeyCodeMapper.guessStableKeyCode(chord.scanCode);
|
|
708
730
|
if (this._OS === OperatingSystem.Linux && !this._isUSStandard) {
|
|
709
|
-
const isOEMKey = (constantKeyCode === KeyCode.Semicolon
|
|
710
|
-
|| constantKeyCode === KeyCode.Equal
|
|
711
|
-
|| constantKeyCode === KeyCode.Comma
|
|
712
|
-
|| constantKeyCode === KeyCode.Minus
|
|
713
|
-
|| constantKeyCode === KeyCode.Period
|
|
714
|
-
|| constantKeyCode === KeyCode.Slash
|
|
715
|
-
|| constantKeyCode === KeyCode.Backquote
|
|
716
|
-
|| constantKeyCode === KeyCode.BracketLeft
|
|
717
|
-
|| constantKeyCode === KeyCode.Backslash
|
|
718
|
-
|| constantKeyCode === KeyCode.BracketRight);
|
|
731
|
+
const isOEMKey = (constantKeyCode === KeyCode.Semicolon || constantKeyCode === KeyCode.Equal || constantKeyCode === KeyCode.Comma || constantKeyCode === KeyCode.Minus || constantKeyCode === KeyCode.Period || constantKeyCode === KeyCode.Slash || constantKeyCode === KeyCode.Backquote || constantKeyCode === KeyCode.BracketLeft || constantKeyCode === KeyCode.Backslash || constantKeyCode === KeyCode.BracketRight);
|
|
719
732
|
if (isOEMKey) {
|
|
720
733
|
return null;
|
|
721
734
|
}
|
|
@@ -740,8 +753,7 @@ class MacLinuxKeyboardMapper {
|
|
|
740
753
|
const chords = [...previousParts, chordPart[i]];
|
|
741
754
|
if (isFinalIndex) {
|
|
742
755
|
result.push(( new NativeResolvedKeybinding(this, this._OS, chords)));
|
|
743
|
-
}
|
|
744
|
-
else {
|
|
756
|
+
} else {
|
|
745
757
|
this._generateResolvedKeybindings(chordParts, currentIndex + 1, chords, result);
|
|
746
758
|
}
|
|
747
759
|
}
|
|
@@ -752,34 +764,13 @@ class MacLinuxKeyboardMapper {
|
|
|
752
764
|
code = ScanCode.Enter;
|
|
753
765
|
}
|
|
754
766
|
const keyCode = keyboardEvent.keyCode;
|
|
755
|
-
if ((keyCode === KeyCode.LeftArrow)
|
|
756
|
-
|| (keyCode === KeyCode.UpArrow)
|
|
757
|
-
|| (keyCode === KeyCode.RightArrow)
|
|
758
|
-
|| (keyCode === KeyCode.DownArrow)
|
|
759
|
-
|| (keyCode === KeyCode.Delete)
|
|
760
|
-
|| (keyCode === KeyCode.Insert)
|
|
761
|
-
|| (keyCode === KeyCode.Home)
|
|
762
|
-
|| (keyCode === KeyCode.End)
|
|
763
|
-
|| (keyCode === KeyCode.PageDown)
|
|
764
|
-
|| (keyCode === KeyCode.PageUp)
|
|
765
|
-
|| (keyCode === KeyCode.Backspace)) {
|
|
767
|
+
if ((keyCode === KeyCode.LeftArrow) || (keyCode === KeyCode.UpArrow) || (keyCode === KeyCode.RightArrow) || (keyCode === KeyCode.DownArrow) || (keyCode === KeyCode.Delete) || (keyCode === KeyCode.Insert) || (keyCode === KeyCode.Home) || (keyCode === KeyCode.End) || (keyCode === KeyCode.PageDown) || (keyCode === KeyCode.PageUp) || (keyCode === KeyCode.Backspace)) {
|
|
766
768
|
const immutableScanCode = IMMUTABLE_KEY_CODE_TO_CODE[keyCode];
|
|
767
769
|
if (immutableScanCode !== ScanCode.DependsOnKbLayout) {
|
|
768
770
|
code = immutableScanCode;
|
|
769
771
|
}
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
if ((code === ScanCode.Numpad1)
|
|
773
|
-
|| (code === ScanCode.Numpad2)
|
|
774
|
-
|| (code === ScanCode.Numpad3)
|
|
775
|
-
|| (code === ScanCode.Numpad4)
|
|
776
|
-
|| (code === ScanCode.Numpad5)
|
|
777
|
-
|| (code === ScanCode.Numpad6)
|
|
778
|
-
|| (code === ScanCode.Numpad7)
|
|
779
|
-
|| (code === ScanCode.Numpad8)
|
|
780
|
-
|| (code === ScanCode.Numpad9)
|
|
781
|
-
|| (code === ScanCode.Numpad0)
|
|
782
|
-
|| (code === ScanCode.NumpadDecimal)) {
|
|
772
|
+
} else {
|
|
773
|
+
if ((code === ScanCode.Numpad1) || (code === ScanCode.Numpad2) || (code === ScanCode.Numpad3) || (code === ScanCode.Numpad4) || (code === ScanCode.Numpad5) || (code === ScanCode.Numpad6) || (code === ScanCode.Numpad7) || (code === ScanCode.Numpad8) || (code === ScanCode.Numpad9) || (code === ScanCode.Numpad0) || (code === ScanCode.NumpadDecimal)) {
|
|
783
774
|
if (keyCode >= 0) {
|
|
784
775
|
const immutableScanCode = IMMUTABLE_KEY_CODE_TO_CODE[keyCode];
|
|
785
776
|
if (immutableScanCode !== ScanCode.DependsOnKbLayout) {
|
|
@@ -808,13 +799,20 @@ class MacLinuxKeyboardMapper {
|
|
|
808
799
|
}
|
|
809
800
|
static _redirectCharCode(charCode) {
|
|
810
801
|
switch (charCode) {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
802
|
+
case CharCode.U_IDEOGRAPHIC_FULL_STOP:
|
|
803
|
+
return CharCode.Period;
|
|
804
|
+
case CharCode.U_LEFT_CORNER_BRACKET:
|
|
805
|
+
return CharCode.OpenSquareBracket;
|
|
806
|
+
case CharCode.U_RIGHT_CORNER_BRACKET:
|
|
807
|
+
return CharCode.CloseSquareBracket;
|
|
808
|
+
case CharCode.U_LEFT_BLACK_LENTICULAR_BRACKET:
|
|
809
|
+
return CharCode.OpenSquareBracket;
|
|
810
|
+
case CharCode.U_RIGHT_BLACK_LENTICULAR_BRACKET:
|
|
811
|
+
return CharCode.CloseSquareBracket;
|
|
812
|
+
case CharCode.U_FULLWIDTH_SEMICOLON:
|
|
813
|
+
return CharCode.Semicolon;
|
|
814
|
+
case CharCode.U_FULLWIDTH_COMMA:
|
|
815
|
+
return CharCode.Comma;
|
|
818
816
|
}
|
|
819
817
|
return charCode;
|
|
820
818
|
}
|
|
@@ -831,27 +829,41 @@ class MacLinuxKeyboardMapper {
|
|
|
831
829
|
}
|
|
832
830
|
const charCode = char.charCodeAt(0);
|
|
833
831
|
switch (charCode) {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
832
|
+
case CharCode.U_Combining_Grave_Accent:
|
|
833
|
+
return CharCode.U_GRAVE_ACCENT;
|
|
834
|
+
case CharCode.U_Combining_Acute_Accent:
|
|
835
|
+
return CharCode.U_ACUTE_ACCENT;
|
|
836
|
+
case CharCode.U_Combining_Circumflex_Accent:
|
|
837
|
+
return CharCode.U_CIRCUMFLEX;
|
|
838
|
+
case CharCode.U_Combining_Tilde:
|
|
839
|
+
return CharCode.U_SMALL_TILDE;
|
|
840
|
+
case CharCode.U_Combining_Macron:
|
|
841
|
+
return CharCode.U_MACRON;
|
|
842
|
+
case CharCode.U_Combining_Overline:
|
|
843
|
+
return CharCode.U_OVERLINE;
|
|
844
|
+
case CharCode.U_Combining_Breve:
|
|
845
|
+
return CharCode.U_BREVE;
|
|
846
|
+
case CharCode.U_Combining_Dot_Above:
|
|
847
|
+
return CharCode.U_DOT_ABOVE;
|
|
848
|
+
case CharCode.U_Combining_Diaeresis:
|
|
849
|
+
return CharCode.U_DIAERESIS;
|
|
850
|
+
case CharCode.U_Combining_Ring_Above:
|
|
851
|
+
return CharCode.U_RING_ABOVE;
|
|
852
|
+
case CharCode.U_Combining_Double_Acute_Accent:
|
|
853
|
+
return CharCode.U_DOUBLE_ACUTE_ACCENT;
|
|
845
854
|
}
|
|
846
855
|
return charCode;
|
|
847
856
|
}
|
|
848
857
|
}
|
|
849
|
-
(function
|
|
858
|
+
(function() {
|
|
850
859
|
function define(charCode, keyCode, shiftKey) {
|
|
851
860
|
for (let i = CHAR_CODE_TO_KEY_CODE.length; i < charCode; i++) {
|
|
852
861
|
CHAR_CODE_TO_KEY_CODE[i] = null;
|
|
853
862
|
}
|
|
854
|
-
CHAR_CODE_TO_KEY_CODE[charCode] = {
|
|
863
|
+
CHAR_CODE_TO_KEY_CODE[charCode] = {
|
|
864
|
+
keyCode: keyCode,
|
|
865
|
+
shiftKey: shiftKey
|
|
866
|
+
};
|
|
855
867
|
}
|
|
856
868
|
for (let chCode = CharCode.A; chCode <= CharCode.Z; chCode++) {
|
|
857
869
|
define(chCode, KeyCode.KeyA + (chCode - CharCode.A), true);
|