clean up
This commit is contained in:
parent
c879e0a802
commit
4c398e9678
1 changed files with 2 additions and 5 deletions
|
|
@ -166,9 +166,8 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
if (this.$lines.length <= 1) {
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
}
|
|
||||||
|
|
||||||
var newLines = this.$split(text);
|
var newLines = this.$split(text);
|
||||||
|
|
||||||
|
|
@ -336,15 +335,13 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.replace = function(range, text) {
|
this.replace = function(range, text) {
|
||||||
// Shortcut: Nothing to replace in this case.
|
|
||||||
if (text.length == 0 && range.isEmpty())
|
if (text.length == 0 && range.isEmpty())
|
||||||
return range.start;
|
return range.start;
|
||||||
|
|
||||||
// Shortcut: If the text we want to insert is the same as it is already
|
// 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.
|
// in the document, we don't have to replace anything.
|
||||||
if (text == this.getTextRange(range)) {
|
if (text == this.getTextRange(range))
|
||||||
return range.end;
|
return range.end;
|
||||||
}
|
|
||||||
|
|
||||||
this.remove(range);
|
this.remove(range);
|
||||||
if (text) {
|
if (text) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue