Fix #24553. We should allow paste content besides the selection.

This commit is contained in:
rebornix 2017-04-12 15:35:38 -07:00
parent 97e8bf8ca3
commit 8d3f2bf45b
2 changed files with 10 additions and 2 deletions

View file

@ -123,7 +123,11 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
}
});
this._editor.setSelections(newSelections);
} else if (!this._dragSelection.containsPosition(newCursorPosition)) {
} else if (!this._dragSelection.containsPosition(newCursorPosition) || (
mouseEvent.event[DragAndDropController.TRIGGER_MODIFIER] && (
this._dragSelection.getEndPosition().equals(newCursorPosition) || this._dragSelection.getStartPosition().equals(newCursorPosition)
) // we allow users to paste content beside the selection
)) {
this._editor.executeCommand(DragAndDropController.ID, new DragAndDropCommand(this._dragSelection, newCursorPosition, mouseEvent.event[DragAndDropController.TRIGGER_MODIFIER]));
}
}

View file

@ -30,7 +30,11 @@ export class DragAndDropCommand implements editorCommon.ICommand {
}
builder.addEditOperation(new Range(this.targetPosition.lineNumber, this.targetPosition.column, this.targetPosition.lineNumber, this.targetPosition.column), text);
if (this.selection.containsPosition(this.targetPosition)) {
if (this.selection.containsPosition(this.targetPosition) && !(
this.copy && (
this.selection.getEndPosition().equals(this.targetPosition) || this.selection.getStartPosition().equals(this.targetPosition)
) // we allow users to paste content beside the selection
)) {
this.targetSelection = this.selection;
return;
}