Show all lines in diff

This fixes a bug where the line count was not caculated correctly.
This commit is contained in:
friebetill 2023-02-14 12:13:55 +08:00
parent add2cb75b4
commit 428d9b4682

View file

@ -89,13 +89,15 @@ export class DifferencesView extends ItemView {
this.lineCount = Math.max(
this.file1Lines.length -
this.fileDifferences.differences
.map((d) => d.file1Lines.length)
.reduce((a, b) => a + b, 0),
// Count each difference as one line
this.fileDifferences.differences.filter(
(d) => d.file1Lines.length > 0
).length,
this.file2Lines.length -
this.fileDifferences.differences
.map((d) => d.file2Lines.length)
.reduce((a, b) => a + b, 0)
// Count each difference as one line
this.fileDifferences.differences.filter(
(d) => d.file2Lines.length > 0
).length
)
}