go-diff
go-diff copied to clipboard
DiffMain does not show deleted space
package main
import (
"fmt"
"github.com/sergi/go-diff/diffmatchpatch"
)
const (
text1 = "package casec"
text2 = "PackageCasec"
)
func main() {
dmp := diffmatchpatch.New()
diffs := dmp.DiffMain(text1, text2, false)
fmt.Println(dmp.DiffPrettyText(diffs))
}
I expected the diff output results for above code to be one of pPackagecCasec
or pPackage[x]cCasec
, but it printed pPackage cCasec
instead. ([x]
indecates a space letter with red background)
So it was a little hard for me to recognize the space
was deleted or not. I think DiffMain
also should show the status of added or deleted space
letters. I think it could be achieved using "space letter with a red or green background".