From 0695b22125e010eafbad47597b9135a4c172dde1 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 3 May 2010 17:57:56 +0200 Subject: [PATCH] clear selection after text input --- src/ace/Editor.js | 2 ++ src/ace/Selection.js | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) 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); };