Fix error with setValue("\nfoo") when wrap mode is on

This commit is contained in:
Joe Cheng 2011-02-17 14:33:20 +08:00 committed by Fabian Jakobs
commit 95d3a2ada7
2 changed files with 21 additions and 0 deletions

View file

@ -183,10 +183,17 @@ var Document = function(text) {
var end = this.insertInLine(position, text);
}
else {
// Insert the first line
if (newLines[0].length > 0) {
var end = this.insertInLine(position, newLines[0]);
this.insertNewLine(end);
}
else {
this.insertNewLine(position);
}
// Now insert remaining lines
// If we are inserting at the end of the document, we don't need to
// use insertInLine (concorde depends on this optimization!)
if (position.row + 1 == this.getLength()) {