mirror of
https://github.com/friebetill/obsidian-file-diff.git
synced 2026-07-22 07:40:25 +00:00
Ignore whitespaces at the end of each line
This commit is contained in:
parent
5c4f98d48b
commit
add2cb75b4
1 changed files with 11 additions and 6 deletions
|
|
@ -70,18 +70,23 @@ export class DifferencesView extends ItemView {
|
|||
this.file1Content = await this.app.vault.read(this.file1)
|
||||
this.file2Content = await this.app.vault.read(this.file2)
|
||||
|
||||
this.file1Lines = this.file1Content
|
||||
.split('\n')
|
||||
// Streamline empty lines at the end as this remove edge cases
|
||||
.map((line) => line.trimEnd())
|
||||
this.file2Lines = this.file2Content
|
||||
.split('\n')
|
||||
// Streamline empty lines at the end as this remove edge cases
|
||||
.map((line) => line.trimEnd())
|
||||
|
||||
const parsedDiff = structuredPatch(
|
||||
this.file1.path,
|
||||
this.file2.path,
|
||||
// Streamline empty lines at the end as this remove edge cases
|
||||
this.file1Content.trimEnd().concat('\n'),
|
||||
this.file2Content.trimEnd().concat('\n')
|
||||
this.file1Lines.join('\n'),
|
||||
this.file2Lines.join('\n')
|
||||
)
|
||||
this.fileDifferences = FileDifferences.fromParsedDiff(parsedDiff)
|
||||
|
||||
this.file1Lines = this.file1Content.split('\n')
|
||||
this.file2Lines = this.file2Content.split('\n')
|
||||
|
||||
this.lineCount = Math.max(
|
||||
this.file1Lines.length -
|
||||
this.fileDifferences.differences
|
||||
|
|
|
|||
Loading…
Reference in a new issue