Skip to content

DiffMain does not show deleted space #96

Open
@mingrammer

Description

@mingrammer
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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions