document.getTextRange shouldn't throw if range is bigger than document
This commit is contained in:
parent
8391b59feb
commit
907b46aed1
1 changed files with 3 additions and 4 deletions
|
|
@ -155,10 +155,9 @@ var Document = function(text) {
|
||||||
range.end.column);
|
range.end.column);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var lines = [];
|
var lines = this.getLines(range.start.row+1, range.end.row-1);
|
||||||
lines.push(this.$lines[range.start.row].substring(range.start.column));
|
lines.unshift((this.$lines[range.start.row] || "").substring(range.start.column));
|
||||||
lines.push.apply(lines, this.getLines(range.start.row+1, range.end.row-1));
|
lines.push((this.$lines[range.end.row] || "").substring(0, range.end.column));
|
||||||
lines.push(this.$lines[range.end.row].substring(0, range.end.column));
|
|
||||||
return lines.join(this.getNewLineCharacter());
|
return lines.join(this.getNewLineCharacter());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue