diff --git a/src/ace/Editor.js b/src/ace/Editor.js index 4dcb2c49..9fabcf60 100644 --- a/src/ace/Editor.js +++ b/src/ace/Editor.js @@ -306,6 +306,8 @@ ace.Editor = function(renderer, doc) { this.doc.remove(range); } + this.clearSelection(); + var lineState = this.bgTokenizer.getState(cursor.row-1); var shouldOutdent = this.mode.checkOutdent(lineState, this.doc.getLine(cursor.row), text); diff --git a/src/ace/Selection.js b/src/ace/Selection.js index b7232955..a3cd5be8 100644 --- a/src/ace/Selection.js +++ b/src/ace/Selection.js @@ -17,7 +17,7 @@ ace.Selection = function(doc) { ace.implement(this, ace.MEventEmitter); this.isEmpty = function() { - return (this.selectionAnchor == null || + return (!this.selectionAnchor || (this.selectionAnchor.row == this.selectionLead.row && this.selectionAnchor.column == this.selectionLead.column)); }; @@ -37,7 +37,6 @@ ace.Selection = function(doc) { this.setSelectionAnchor = function(row, column) { this.clearSelection(); - this.selectionAnchor = this.$clipPositionToDocument(row, column); };