Skip to content

Commit

Permalink
list: select element when increasing selection range. Do not select e…
Browse files Browse the repository at this point in the history
…lement when removing it from selection

fixes #43233
  • Loading branch information
isidorn committed Feb 16, 2018
1 parent e47770a commit 5dc3c59
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/vs/base/browser/ui/list/listWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,18 @@ class MouseController<T> implements IDisposable {
}

let reference = this.list.getFocus()[0];
reference = reference === undefined ? this.list.getSelection()[0] : reference;
const selection = this.list.getSelection();
reference = reference === undefined ? selection[0] : reference;

const focus = e.index;
if (selection.every(s => s !== focus)) {
this.list.setFocus([focus]);
}

if (this.multipleSelectionSupport && this.isSelectionRangeChangeEvent(e)) {
return this.changeSelection(e, reference);
}

const focus = e.index;
this.list.setFocus([focus]);

if (this.multipleSelectionSupport && this.isSelectionChangeEvent(e)) {
return this.changeSelection(e, reference);
}
Expand Down

0 comments on commit 5dc3c59

Please sign in to comment.