Keep the limit at 2 chords in the widget for now

This commit is contained in:
Alex Dima 2023-03-16 14:33:02 +01:00
parent 5303e9d7e1
commit 55c32ae2e0
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9

View file

@ -117,6 +117,10 @@ export class KeybindingsSearchWidget extends SearchWidget {
if (!this._chords) {
this._chords = [];
}
if (this._chords.length === 2) {
// TODO: keep the limit at 2 for now
this._chords = [];
}
const lastChordIsComplete = (this._chords.length === 0 || this._chords[this._chords.length - 1].getDispatchChords()[0] !== null);
if (lastChordIsComplete) {
this._chords.push(keybinding);
@ -242,12 +246,9 @@ export class DefineKeybindingWidget extends Widget {
dom.clearNode(this._outputNode);
dom.clearNode(this._showExistingKeybindingsNode);
const firstLabel = new KeybindingLabel(this._outputNode, OS, defaultKeybindingLabelStyles);
firstLabel.set(withNullAsUndefined(this._chords?.[0]));
if (this._chords) {
for (let i = 1; i < this._chords.length; i++) {
this._outputNode.appendChild(document.createTextNode(nls.localize('defineKeybinding.chordsTo', "chord to")));