From b531e13f9fb9df2480d73e68fca7c01821a186fc Mon Sep 17 00:00:00 2001 From: Lukas Petr Date: Fri, 16 Feb 2024 20:55:20 +0100 Subject: [PATCH] fix: not showing empty context line below diff For diffs with context around hunks (eg. using git diff -U1), if the context line below a diff was empty then the line was not shown, this commit fixes it. --- src/utils/parse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/parse.ts b/src/utils/parse.ts index 32d5019..3b1e111 100644 --- a/src/utils/parse.ts +++ b/src/utils/parse.ts @@ -94,7 +94,7 @@ function normalizeDiffText(text: string) { } export function parseDiff(text: string, options: ParseOptions = {}): File[] { - const diffText = normalizeDiffText(text.trim()); + const diffText = normalizeDiffText(text.trimStart()); const files = parser.parse(diffText); return files.map(file => mapFile(file, options));