Skip to content

DiffPrettyText does does not colour all diffs with newlines #138

@michaelcheah

Description

@michaelcheah

Using the following example:

dmp := New()
diffs := dmp.DiffMain("a\nb\nc\ndef\ni", "a\ndef\ng\nh\ni", false)

Produces the following diffs:

diff2 := []Diff{
	{Type:DiffEqual, Text:"a\n"}, 
	{Type:DiffDelete, Text:"b\nc\n"}, 
	{Type:DiffEqual, Text:"def"}, 
	{Type:DiffInsert, Text:"\ng\nh"}, 
	{Type:DiffEqual, Text:"\ni"},
}

Pretty printing to stdout

fmt.Println(dmp.DiffPrettyText(diffs))

Produces the following stdout
image

However, I expected:
image

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