Skip to content

Commit

Permalink
SelectBox: Fix selectable separator. Fixes #58961 (#58982)
Browse files Browse the repository at this point in the history
  • Loading branch information
cleidigh committed Sep 19, 2018
1 parent aacaecc commit abee50e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/vs/base/browser/ui/selectBox/selectBoxCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ export class SelectBoxList implements ISelectBoxDelegate, IVirtualDelegate<ISele

this.selected = selected || 0;

// CDL check
if (options) {
this.setOptions(options, selected);
}
Expand Down Expand Up @@ -260,13 +259,19 @@ export class SelectBoxList implements ISelectBoxDelegate, IVirtualDelegate<ISele
this.options.forEach((option) => {
this.selectElement.add(this.createOption(option, i, disabled === i++));
});
}

if (selected !== undefined) {
this.select(selected);
// Set current = selected since this is not necessarily a user exit
this._currentSelection = this.selected;
if (selected !== undefined) {
this.select(selected);
// Set current = selected since this is not necessarily a user exit
this._currentSelection = this.selected;
}

if (disabled !== undefined) {
this.disabledOptionIndex = disabled;
}
}


}


Expand Down Expand Up @@ -928,6 +933,8 @@ export class SelectBoxList implements ISelectBoxDelegate, IVirtualDelegate<ISele
// Skip disabled options
if ((this.selected + 1) === this.disabledOptionIndex && this.options.length > this.selected + 2) {
this.selected += 2;
} else if ((this.selected + 1) === this.disabledOptionIndex) {
return;
} else {
this.selected++;
}
Expand Down

0 comments on commit abee50e

Please sign in to comment.