Bug: For diff with context containing empty line the empty line is not shown
Closed this issue · 2 comments
PLukas2018 commented
For diffs with context around hunks (eg. using git diff -U1
), if the context line below a diff is empty then the line is not shown.
The bug exists probably since v2.4.2
and is probably caused by trim
method on the diff which removes the empty context line.
react-diff-view/src/utils/parse.ts
Line 97 in 49cebd0
Example:
Older version of a file:
void foo() {
if (cond)
doSomething();
// Below is empty line
}
New version of the file:
void foo() {
if (cond) {
doSomething();
doSomethingNext();
}
// Below is still empty line
}
Diff gained by git diff -U1
diff --git a/a.c b/a.c
index ca1fe9c..e6f7947 100644
--- a/a.c
+++ b/a.c
@@ -2,5 +2,7 @@ void foo() {
- if (cond)
+ if (cond) {
doSomething();
- // Below is empty line
+ doSomethingNext();
+ }
+ // Below is still empty line
Result of visualisaton using react-diff-view: (with missing context line below diff)
Expected result (v2.4.1
): (with context line below diff)
otakustay commented
Seems you are working on it, I'll wait for a PR, thanks
PLukas2018 commented
Solved by #216