dragging when ctrl/alt is pressed must copy selection

This commit is contained in:
nightwing 2011-10-18 10:16:47 +05:00
commit c5a53431e8

View file

@ -126,18 +126,18 @@ function DefaultHandlers(editor) {
mousePageY = event.getDocumentY(e);
};
var onMouseSelectionEnd = function() {
var onMouseSelectionEnd = function(e) {
clearInterval(timerId);
if (state == STATE_UNKNOWN)
onStartSelect(pos);
else if (state == STATE_DRAG)
onMouseDragSelectionEnd();
onMouseDragSelectionEnd(e);
_self.$clickSelection = null;
state = STATE_UNKNOWN;
};
var onMouseDragSelectionEnd = function() {
var onMouseDragSelectionEnd = function(e) {
dom.removeCssClass(editor.container, "ace_dragging");
editor.session.removeMarker(dragSelectionMarker);
@ -157,7 +157,12 @@ function DefaultHandlers(editor) {
}
editor.clearSelection();
var newRange = editor.moveText(dragRange, dragCursor);
if (e && (e.ctrlKey || e.altKey)) {
var session = editor.session;
var newRange = session.insert(dragCursor, session.getTextRange(dragRange));
} else {
var newRange = editor.moveText(dragRange, dragCursor);
}
if (!newRange) {
dragCursor = null;
return;