提交 172991e2 编写于 作者: S Sandeep Somavarapu

fix #32993

上级 5e27e57a
......@@ -385,7 +385,7 @@ class KeybindingItemMatches {
return false;
}
const ariaLabel = keybinding.keyAriaLabel;
if (ariaLabel.length === 1 || word.length === 1) {
if (this.completeMatch || ariaLabel.length === 1 || word.length === 1) {
if (strings.compareIgnoreCase(ariaLabel, word) === 0) {
return true;
}
......
......@@ -520,7 +520,7 @@ suite('Keybindings Editor Model test', () => {
prepareKeybindingService(expected, aResolvedKeybindingItem({ command, firstPart: { keyCode: KeyCode.KEY_C, modifiers: { ctrlKey: true } }, when: 'whenContext1 && whenContext2', isDefault: false }));
return testObject.resolve().then(() => {
const actual = testObject.fetch('"shift meta esc ctrl c"').filter(element => element.keybindingItem.command === command);
const actual = testObject.fetch('"shift meta escape ctrl c"').filter(element => element.keybindingItem.command === command);
assert.equal(1, actual.length);
assert.deepEqual(actual[0].keybindingMatches.firstPart, { shiftKey: true, metaKey: true, keyCode: true });
assert.deepEqual(actual[0].keybindingMatches.chordPart, { ctrlKey: true, keyCode: true });
......@@ -558,13 +558,24 @@ suite('Keybindings Editor Model test', () => {
prepareKeybindingService(expected, aResolvedKeybindingItem({ command, firstPart: { keyCode: KeyCode.KEY_C, modifiers: { ctrlKey: true } }, when: 'whenContext1 && whenContext2', isDefault: false }));
return testObject.resolve().then(() => {
const actual = testObject.fetch('"shift+meta+esc ctrl+c"').filter(element => element.keybindingItem.command === command);
const actual = testObject.fetch('"shift+meta+escape ctrl+c"').filter(element => element.keybindingItem.command === command);
assert.equal(1, actual.length);
assert.deepEqual(actual[0].keybindingMatches.firstPart, { shiftKey: true, metaKey: true, keyCode: true });
assert.deepEqual(actual[0].keybindingMatches.chordPart, { keyCode: true, ctrlKey: true });
});
});
test('filter exact matches with space #32993', () => {
const command = 'a' + uuid.generateUuid();
const expected = aResolvedKeybindingItem({ command, firstPart: { keyCode: KeyCode.Space, modifiers: { ctrlKey: true } }, when: 'whenContext1 && whenContext2', isDefault: false });
prepareKeybindingService(expected, aResolvedKeybindingItem({ command, firstPart: { keyCode: KeyCode.Backspace, modifiers: { ctrlKey: true } }, when: 'whenContext1 && whenContext2', isDefault: false }));
return testObject.resolve().then(() => {
const actual = testObject.fetch('"ctrl+space"').filter(element => element.keybindingItem.command === command);
assert.equal(1, actual.length);
});
});
function prepareKeybindingService(...keybindingItems: ResolvedKeybindingItem[]): ResolvedKeybindingItem[] {
instantiationService.stub(IKeybindingService, 'getKeybindings', () => keybindingItems);
instantiationService.stub(IKeybindingService, 'getDefaultKeybindings', () => keybindingItems);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册