fix(parser/diff): newline after strings
Some checks failed
build / trigger-build-image (push) Blocked by required conditions
build / build (push) Has been cancelled
submodules sync / sync (push) Has been cancelled

This commit is contained in:
张泊明518370910136 2025-03-28 07:13:58 -04:00
parent 985e9c43a2
commit 815cf6506e
GPG Key ID: D47306D7062CDA9D
2 changed files with 7 additions and 1 deletions

@ -1 +1 @@
Subproject commit 73e4be7cf69513990f13a28d3a4df94cae2669db Subproject commit 6a6b1f781ee2673960d8e6bd0085257846ccdf83

View File

@ -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, // 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. // when in fact the algorithm is faster than the standard one.
func patienceDiff(old, new string, compareSpace bool) string { 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") x := strings.SplitAfter(old, "\n")
y := strings.SplitAfter(new, "\n") y := strings.SplitAfter(new, "\n")