diff --git a/src/ace/Editor.js b/src/ace/Editor.js index 6653f562..648e0f0a 100644 --- a/src/ace/Editor.js +++ b/src/ace/Editor.js @@ -271,9 +271,13 @@ var Editor = function(renderer, doc) { var pos = this.renderer.screenToTextCoordinates(pageX, pageY); pos.row = Math.max(0, Math.min(pos.row, this.doc.getLength()-1)); - this.moveCursorToPosition(pos); - if (!this.$clickSelection) - this.selection.setSelectionAnchor(pos.row, pos.column); + if (e.shiftKey) + this.selection.selectToPosition(pos) + else { + this.moveCursorToPosition(pos); + if (!this.$clickSelection) + this.selection.clearSelection(pos.row, pos.column); + } this.renderer.scrollCursorIntoView(); diff --git a/src/ace/Selection.js b/src/ace/Selection.js index b781e42e..6f6178ef 100644 --- a/src/ace/Selection.js +++ b/src/ace/Selection.js @@ -363,6 +363,7 @@ var Selection = function(doc) { this.moveCursorTo = function(row, column) { var cursor = this.$clipPositionToDocument(row, column); + // only dispatch change if the cursor actually changed if (cursor.row !== this.selectionLead.row || cursor.column !== this.selectionLead.column) { this.selectionLead = cursor; this.$dispatchEvent("changeCursor", { data: this.getCursor() });