Skip to content

Commit a21c123

Browse files
committed
Fixes #8535
1 parent 0a6f5ae commit a21c123

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/vs/editor/node/model/modelBuilder.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ModelLineBasedBuilder {
3030
this.currLineIndex = 0;
3131
}
3232

33-
public acceptLines(lines:string[], linesLength:number): void {
33+
public acceptLines(lines:string[]): void {
3434
if (this.currLineIndex === 0) {
3535
// Remove the BOM (if present)
3636
if (strings.startsWithUTF8BOM(lines[0])) {
@@ -39,10 +39,10 @@ class ModelLineBasedBuilder {
3939
}
4040
}
4141

42-
for (let i = 0; i < linesLength; i++) {
42+
for (let i = 0, len = lines.length; i < len; i++) {
4343
this.lines[this.currLineIndex++] = lines[i];
44-
this.hash.update(lines[i] + '\n');
4544
}
45+
this.hash.update(lines.join('\n') + '\n');
4646
}
4747

4848
public finish(totalLength:number, carriageReturnCnt:number, opts:ITextModelCreationOptions): ModelBuilderResult {
@@ -178,7 +178,7 @@ export class ModelBuilder {
178178
}
179179

180180
lines[0] = this.leftoverPrevChunk + lines[0];
181-
this.lineBasedBuilder.acceptLines(lines, lines.length - 1);
181+
this.lineBasedBuilder.acceptLines(lines.slice(0, lines.length - 1));
182182
this.leftoverPrevChunk = lines[lines.length - 1];
183183
}
184184

@@ -187,7 +187,7 @@ export class ModelBuilder {
187187
if (this.leftoverEndsInCR) {
188188
finalLines.push('');
189189
}
190-
this.lineBasedBuilder.acceptLines(finalLines, finalLines.length);
190+
this.lineBasedBuilder.acceptLines(finalLines);
191191
return this.lineBasedBuilder.finish(this.totalLength, this.totalCRCount, opts);
192192
}
193193
}

0 commit comments

Comments
 (0)