This commit is contained in:
Fabian Jakobs 2011-01-19 12:50:19 +01:00
commit 4c398e9678

View file

@ -166,9 +166,8 @@ var Document = function(text) {
position = this.$clipPosition(position);
if (this.$lines.length <= 1) {
if (this.getLength() <= 1)
this.$detectNewLine(text);
}
var newLines = this.$split(text);
@ -336,15 +335,13 @@ var Document = function(text) {
};
this.replace = function(range, text) {
// Shortcut: Nothing to replace in this case.
if (text.length == 0 && range.isEmpty())
return range.start;
// Shortcut: If the text we want to insert is the same as it is already
// in the document, we don't have to replace anything.
if (text == this.getTextRange(range)) {
if (text == this.getTextRange(range))
return range.end;
}
this.remove(range);
if (text) {