This commit is contained in:
Sandeep Somavarapu
2017-08-30 16:04:09 +02:00
parent 5e27e57a8f
commit 172991e241
2 changed files with 14 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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);