From 4483598166a708aeecbbaec7ff7b46b8130b6c8a Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Tue, 4 May 2010 11:41:28 +0200 Subject: [PATCH] add additional checks --- src/ace/Document.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ace/Document.js b/src/ace/Document.js index 2df8ae7b..93a68f3d 100644 --- a/src/ace/Document.js +++ b/src/ace/Document.js @@ -304,6 +304,9 @@ ace.Document = function(text, mode) { }; this.$insertLines = function(row, lines) { + if (lines.length == 0) + return; + var args = [row, 0]; args.push.apply(args, lines); this.lines.splice.apply(this.lines, args); @@ -320,6 +323,9 @@ ace.Document = function(text, mode) { }, this.$insert = function(position, text, fromUndo) { + if (text.length == 0) + return; + this.modified = true; if (this.lines.length <= 1) { this.$detectNewLine(text); @@ -383,6 +389,9 @@ ace.Document = function(text, mode) { }; this.remove = function(range, fromUndo) { + if (range.isEmpty()) + return; + this.$remove(range, fromUndo); this.fireChangeEvent(range.start.row, @@ -393,6 +402,9 @@ ace.Document = function(text, mode) { }; this.$remove = function(range, fromUndo) { + if (range.isEmpty()) + return; + if (!fromUndo && this.$undoManager) { var nl = this.$getNewLineCharacter(); this.$deltas.push({