Don't access private $lines array of the document.

There are document implementations, which don't have this.
This commit is contained in:
Fabian Jakobs 2011-05-20 15:23:20 +02:00
commit 51d2a348c7

View file

@ -317,7 +317,7 @@ function Folding() {
throw "A fold can't end inside of an already existing fold"; throw "A fold can't end inside of an already existing fold";
} }
if (endRow >= this.doc.$lines.length) { if (endRow >= this.doc.getLength()) {
throw "End of fold is outside of the document."; throw "End of fold is outside of the document.";
} }
@ -493,7 +493,7 @@ function Folding() {
// Build the textline using the FoldLine walker. // Build the textline using the FoldLine walker.
var line = ""; var line = "";
var lines = this.doc.$lines; var doc = this.doc;
var textLine = ""; var textLine = "";
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) { foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
@ -508,7 +508,7 @@ function Folding() {
if (placeholder) { if (placeholder) {
textLine += placeholder; textLine += placeholder;
} else { } else {
textLine += lines[row].substring(lastColumn, column); textLine += doc.getLine(row).substring(lastColumn, column);
} }
}.bind(this), endRow, endColumn); }.bind(this), endRow, endColumn);
return textLine; return textLine;
@ -519,7 +519,7 @@ function Folding() {
if (!foldLine) { if (!foldLine) {
var line; var line;
line = this.doc.$lines[row]; line = this.doc.getLine(row);
return line.substring(startColumn || 0, endColumn || line.length); return line.substring(startColumn || 0, endColumn || line.length);
} else { } else {
return this.getFoldDisplayLine( return this.getFoldDisplayLine(