From 8f1f33d52def32a3a3ef8561a0945e3334804db9 Mon Sep 17 00:00:00 2001 From: friebetill Date: Sat, 4 Feb 2023 12:37:33 +0800 Subject: [PATCH] Handle empty lines at the end --- src/components/differences_view.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/differences_view.ts b/src/components/differences_view.ts index 358e256..39e2d80 100644 --- a/src/components/differences_view.ts +++ b/src/components/differences_view.ts @@ -64,8 +64,9 @@ export class DifferencesView extends ItemView { structuredPatch( this.file1.path, this.file2.path, - this.file1Content, - this.file2Content + // Ignore empty lines at the end as they are difficult to handle + this.file1Content.trimEnd(), + this.file2Content.trimEnd() ) ) @@ -162,10 +163,4 @@ export class DifferencesView extends ItemView { }).open() }) } - - delay(ms: number): Promise { - return new Promise((resolve) => { - setTimeout(resolve, ms) - }) - } }