326
327
public dumpDebugInfo(): string {
329
>
330
>
const immutableSamples = [
331
>
ScanCode.ArrowUp,
332
>
ScanCode.Numpad0
333
>
];
334
>
335
>
let cnt = 0;
336
>
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
337
>
for (let scanCode = ScanCode.None; scanCode < ScanCode.MAX_VALUE; scanCode++) {
338
>
if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== KeyCode.DependsOnKbLayout) {
339
>
if (immutableSamples.indexOf(scanCode) === -1) {
340
>
continue;
341
>
}
342
>
}
343
>
344
>
if (cnt % 6 === 0) {
345
>
result.push(`| HW Code combination | Key | KeyCode combination | UI label | User settings | WYSIWYG |`);
346
>
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
347
>
}
348
>
cnt++;
349
>
350
>
const mapping = this._codeInfo[scanCode];
351
>
const strCode = ScanCodeUtils.toString(scanCode);
352
>
353
>
const mods = [0b000, 0b010, 0b101, 0b111];
354
>
for (const mod of mods) {
355
>
const ctrlKey = (mod & 0b001) ? true : false;
356
>
const shiftKey = (mod & 0b010) ? true : false;
357
>
const altKey = (mod & 0b100) ? true : false;
358
>
const scanCodeChord = new ScanCodeChord(ctrlKey, shiftKey, altKey, false, scanCode);
359
>
const keyCodeChord = this._resolveChord(scanCodeChord);
360
>
const strKeyCode = (keyCodeChord ? KeyCodeUtils.toString(keyCodeChord.keyCode) : null);
361
>
const resolvedKb = (keyCodeChord ? new WindowsNativeResolvedKeybinding(this, [keyCodeChord]) : null);
362
>
363
>
const outScanCode = `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strCode}`;
364
>
const ariaLabel = (resolvedKb ? resolvedKb.getAriaLabel() : null);
365
>
const outUILabel = (ariaLabel ? ariaLabel.replace(/Control\+/, 'Ctrl+') : null);
366
>
const outUserSettings = (resolvedKb ? resolvedKb.getUserSettingsLabel() : null);
367
>
const outKey = WindowsNativeResolvedKeybinding.getProducedChar(scanCodeChord, mapping);
368
>
const outKb = (strKeyCode ? `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strKeyCode}` : null);
369
>
const isWYSIWYG = (resolvedKb ? resolvedKb.isWYSIWYG() : false);
370
>
const outWYSIWYG = (isWYSIWYG ? ' ' : ' NO ');
371
>
result.push(`| ${this._leftPad(outScanCode, 30)} | ${outKey} | ${this._leftPad(outKb, 25)} | ${this._leftPad(outUILabel, 25)} | ${this._leftPad(outUserSettings, 25)} | ${outWYSIWYG} |`);
372
>
}
373
>
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
374
>
}
375
>
376
>
377
>
return result.join('\n');
378
>
}
379
380
private _leftPad(str: string | null, cnt: number): string {
382
>
str = 'null';
383
>
}
384
>
while (str.length < cnt) {
385
>
str = ' ' + str;
386
>
}
387
>
return str;
388
>
}
389
390
public getUILabelForKeyCode(keyCode: KeyCode): string {