Fix bug when file 2 has multiple lines

This commit is contained in:
friebetill 2023-02-10 12:25:32 +08:00
parent 56b8e2d7b0
commit c3b005e909

View file

@ -83,8 +83,14 @@ export class DifferencesView extends ItemView {
this.file2Lines = this.file2Content.split('\n')
this.lineCount = Math.max(
this.file1Lines.length,
this.file2Lines.length
this.file1Lines.length -
this.fileDifferences.differences
.map((d) => d.file1Lines.length)
.reduce((a, b) => a + b, 0),
this.file2Lines.length -
this.fileDifferences.differences
.map((d) => d.file2Lines.length)
.reduce((a, b) => a + b, 0)
)
}