Skip to content

Commit 075c4c9

Browse files
committed
Fix diff text whitespace
1 parent 81fbcbb commit 075c4c9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

format.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import (
1010
func DiffText(diffs []DiffLine) string {
1111
s := make([]string, len(diffs))
1212
for i, l := range diffs {
13+
if len(l.Text) == 0 && l.Type == Equal {
14+
continue
15+
}
1316
prefix := " "
1417
switch l.Type {
1518
case Insert:

patience_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ int main(int argc, char **argv)
223223
}`, "\n")
224224

225225
want := ` #include <stdio.h>
226-
226+
227227
+int fib(int n)
228228
+{
229229
+ if(n > 2)
@@ -243,7 +243,7 @@ int main(int argc, char **argv)
243243
printf("%d\n", foo);
244244
}
245245
}
246-
246+
247247
-int fact(int n)
248248
-{
249249
- if(n > 1)

0 commit comments

Comments
 (0)