Skip to content

Duplicate output from Combined diff #69

@gurgenhakobyan

Description

@gurgenhakobyan

Hi @jfcherng ,

First of all, thanks for your great work. Looks like there is one issue with the diff tool, I'll try to explain it below.

When having 3 lines edited from the beginning of the text, Combined diff gives the same result 3 times. Here is an example of the code:

            $textA = "111\n222\n333\nLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.\n";

            $textB = "999\n888\n777\nLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.\n";

            $testResult = DiffHelper::calculate(
                $textA,
                $textB,
                'Combined',
                ['context' => Differ::CONTEXT_ALL],
                ['showHeader' => false]
            );

The output is like this
image

With other renderers (Json, inline). the result is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions