514
515
public getLinesContent(): string[] {
517
>
let linesLength = 0;
518
>
let currentLine = '';
519
>
let danglingCR = false;
520
>
521
>
this.iterate(this.root, node => {
522
>
if (node === SENTINEL) {
523
>
return true;
524
>
}
525
>
526
>
const piece = node.piece;
527
>
let pieceLength = piece.length;
528
>
if (pieceLength === 0) {
529
return true;
530
}
532
>
const buffer = this._buffers[piece.bufferIndex].buffer;
533
>
const lineStarts = this._buffers[piece.bufferIndex].lineStarts;
534
>
535
>
const pieceStartLine = piece.start.line;
536
>
const pieceEndLine = piece.end.line;
537
>
let pieceStartOffset = lineStarts[pieceStartLine] + piece.start.column;
538
>
539
>
if (danglingCR) {
540
if (buffer.charCodeAt(pieceStartOffset) === CharCode.LineFeed) {
541
// pretend the \n was in the previous piece..