diff --git a/examples/diff/complex b/examples/diff/complex index 73e4be7..6a6b1f7 160000 --- a/examples/diff/complex +++ b/examples/diff/complex @@ -1 +1 @@ -Subproject commit 73e4be7cf69513990f13a28d3a4df94cae2669db +Subproject commit 6a6b1f781ee2673960d8e6bd0085257846ccdf83 diff --git a/internal/parser/diff/patience.go b/internal/parser/diff/patience.go index 2aa5b1e..f6e56e6 100644 --- a/internal/parser/diff/patience.go +++ b/internal/parser/diff/patience.go @@ -45,6 +45,12 @@ type pair struct{ x, y int } // to wait longer (to be patient) for the diff, meaning that it is a slower algorithm, // when in fact the algorithm is faster than the standard one. func patienceDiff(old, new string, compareSpace bool) string { + if len(old) != 0 && old[len(old)-1] != '\n' { + old += "\n" + } + if len(new) != 0 && new[len(new)-1] != '\n' { + new += "\n" + } x := strings.SplitAfter(old, "\n") y := strings.SplitAfter(new, "\n")