From 0366fbc8129ffd6a94fed008b6f1c18ac3370aa3 Mon Sep 17 00:00:00 2001 From: Ulugbek Abdullaev Date: Thu, 30 Mar 2023 18:03:49 +0200 Subject: [PATCH] keybindingResolver: more cleanup --- src/vs/platform/keybinding/common/keybindingResolver.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/vs/platform/keybinding/common/keybindingResolver.ts b/src/vs/platform/keybinding/common/keybindingResolver.ts index 37e0cf8d510..005322cd5a2 100644 --- a/src/vs/platform/keybinding/common/keybindingResolver.ts +++ b/src/vs/platform/keybinding/common/keybindingResolver.ts @@ -350,15 +350,14 @@ export class KeybindingResolver { return NoMatchingKb; } - if (currentChords.length === 0 && result.chords.length > 1 && result.chords[1] !== null) { // first chord of a multi-chord KB matched - this._log(`\\ From ${lookupMap.length} keybinding entries, matched chord, when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`); - return MoreChordsNeeded; - } else if (currentChords.length !== 0 && currentChords.length + 1 < result.chords.length) { // prefix (ie, a sequence of chords) of a multi-chord KB matched, eg 2 out of 3 matched - still need one more to dispatch the KB - this._log(`\\ From ${lookupMap.length} keybinding entries, continued chord, when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`); + if (currentChords.length + 1 /* keypress */ < result.chords.length) { + // The chord sequence is not complete + this._log(`\\ From ${lookupMap.length} keybinding entries, awaiting ${result.chords.length - currentChords.length - 1} more chord(s), when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`); return MoreChordsNeeded; } this._log(`\\ From ${lookupMap.length} keybinding entries, matched ${result.command}, when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`); + return KbFound(result.command, result.commandArgs, result.bubble); }