提交 2416f60c 编写于 作者: A Alex Dima

Fix issue in resolveUserBinding

上级 a03a09b4
......@@ -932,17 +932,21 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
return this.simpleKeybindingToScanCodeBinding(binding);
}
public resolveUserBinding(firstPart: SimpleKeybinding | ScanCodeBinding, chordPart: SimpleKeybinding | ScanCodeBinding): ResolvedKeybinding[] {
const firstParts = this._resolveSimpleUserBinding(firstPart);
const chordParts = this._resolveSimpleUserBinding(chordPart);
public resolveUserBinding(_firstPart: SimpleKeybinding | ScanCodeBinding, _chordPart: SimpleKeybinding | ScanCodeBinding): ResolvedKeybinding[] {
const firstParts = this._resolveSimpleUserBinding(_firstPart);
const chordParts = this._resolveSimpleUserBinding(_chordPart);
let result: NativeResolvedKeybinding[] = [], resultLen = 0;
for (let i = 0, len = firstParts.length; i < len; i++) {
const firstPart = firstParts[i];
for (let j = 0, lenJ = chordParts.length; j < lenJ; j++) {
const chordPart = chordParts[j];
if (_chordPart) {
for (let j = 0, lenJ = chordParts.length; j < lenJ; j++) {
const chordPart = chordParts[j];
result[resultLen++] = new NativeResolvedKeybinding(this, this._OS, firstPart, chordPart);
result[resultLen++] = new NativeResolvedKeybinding(this, this._OS, firstPart, chordPart);
}
} else {
result[resultLen++] = new NativeResolvedKeybinding(this, this._OS, firstPart, null);
}
}
return result;
......
......@@ -119,7 +119,7 @@ suite('keyboardMapper - MAC fallback', () => {
});
});
suite('keyboardMapper - MAC fallback', () => {
suite('keyboardMapper - LINUX fallback', () => {
let mapper = new MacLinuxFallbackKeyboardMapper({}, OperatingSystem.Linux);
......@@ -224,4 +224,26 @@ suite('keyboardMapper - MAC fallback', () => {
}]
);
});
test('resolveUserBinding Ctrl+[Comma]', () => {
assertResolveUserBinding(
mapper,
new ScanCodeBinding(true, false, false, false, ScanCode.Comma),
null,
[{
label: 'Ctrl+,',
ariaLabel: 'Control+,',
HTMLLabel: [_simpleHTMLLabel(['Ctrl', ','])],
electronAccelerator: 'Ctrl+,',
userSettingsLabel: 'ctrl+,',
isWYSIWYG: true,
isChord: false,
hasCtrlModifier: true,
hasShiftModifier: false,
hasAltModifier: false,
hasMetaModifier: false,
dispatchParts: ['ctrl+,', null],
}]
);
});
});
......@@ -1232,6 +1232,28 @@ suite('keyboardMapper - LINUX en_us', () => {
}]
);
});
test('resolveUserBinding Ctrl+[Comma]', () => {
assertResolveUserBinding(
mapper,
new ScanCodeBinding(true, false, false, false, ScanCode.Comma),
null,
[{
label: 'Ctrl+,',
ariaLabel: 'Control+,',
HTMLLabel: [_simpleHTMLLabel(['Ctrl', ','])],
electronAccelerator: 'Ctrl+,',
userSettingsLabel: 'ctrl+,',
isWYSIWYG: true,
isChord: false,
hasCtrlModifier: true,
hasShiftModifier: false,
hasAltModifier: false,
hasMetaModifier: false,
dispatchParts: ['ctrl+[Comma]', null],
}]
);
});
});
function _assertKeybindingTranslation(mapper: MacLinuxKeyboardMapper, OS: OperatingSystem, kb: number, _expected: string | string[]): void {
......
......@@ -430,4 +430,26 @@ suite('keyboardMapper - WINDOWS en_us', () => {
}]
);
});
test('resolveUserBinding Ctrl+[Comma]', () => {
assertResolveUserBinding(
mapper,
new ScanCodeBinding(true, false, false, false, ScanCode.Comma),
null,
[{
label: 'Ctrl+,',
ariaLabel: 'Control+,',
HTMLLabel: [_simpleHTMLLabel(['Ctrl', ','])],
electronAccelerator: 'Ctrl+,',
userSettingsLabel: 'ctrl+,',
isWYSIWYG: true,
isChord: false,
hasCtrlModifier: true,
hasShiftModifier: false,
hasAltModifier: false,
hasMetaModifier: false,
dispatchParts: ['ctrl+,', null],
}]
);
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册