Skip to content

Commit

Permalink
Fix #28688. Shift-click in DND area shoud behave the same way as non-…
Browse files Browse the repository at this point in the history
…DND.
  • Loading branch information
rebornix committed Nov 27, 2017
1 parent 2663114 commit 6661b08
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/vs/editor/contrib/dnd/dnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,20 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
let newCursorPosition = new Position(mouseEvent.target.position.lineNumber, mouseEvent.target.position.column);

if (this._dragSelection === null) {
let newSelections = this._editor.getSelections().map(selection => {
if (selection.containsPosition(newCursorPosition)) {
return new Selection(newCursorPosition.lineNumber, newCursorPosition.column, newCursorPosition.lineNumber, newCursorPosition.column);
} else {
return selection;
}
});
this._editor.setSelections(newSelections);
if (mouseEvent.event.shiftKey) {
let primarySelection = this._editor.getSelection();
let { startLineNumber, startColumn } = primarySelection;
this._editor.setSelections([new Selection(startLineNumber, startColumn, newCursorPosition.lineNumber, newCursorPosition.column)]);
} else {
let newSelections = this._editor.getSelections().map(selection => {
if (selection.containsPosition(newCursorPosition)) {
return new Selection(newCursorPosition.lineNumber, newCursorPosition.column, newCursorPosition.lineNumber, newCursorPosition.column);
} else {
return selection;
}
});
this._editor.setSelections(newSelections);
}
} else if (!this._dragSelection.containsPosition(newCursorPosition) ||
(
(
Expand Down

0 comments on commit 6661b08

Please sign in to comment.