php-diff
php-diff copied to clipboard
Long text diff
Hi and thanks for your great library. I have a problem with long texts comparisons. I have these configs:
// the Diff class options
$differOptions = [
'context' => Differ::CONTEXT_ALL,
'ignoreCase' => false,
'ignoreLineEnding' => false,
'ignoreWhitespace' => false,
'lengthLimit' => 200000,
'fullContextIfIdentical' => false,
];
// the renderer class options
$rendererOptions = [
'detailLevel' => 'word',
'language' => 'eng',
'lineNumbers' => false,
'separateBlock' => false,
'showHeader' => false,
'spacesToNbsp' => false,
'tabSize' => 4,
'mergeThreshold' => 0.8,
'cliColorization' => RendererConstant::CLI_COLOR_AUTO,
'outputTagAsString' => false,
'jsonEncodeFlags' => \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE,
'wordGlues' => [' ', '-'],
'resultForIdenticals' => null,
'wrapperClasses' => ['diff-wrapper '],
];
$rendererName = 'Combined';
$result = DiffHelper::calculate($old, $new, $rendererName, $differOptions, $rendererOptions);
And I wanted to compare these 2 texts:
When the context set to Differ::CONTEXT_ALL it will not show the full text on the result. I need to see the removed sentences and added sentences and also modified sentences too.
I need to have a result like this. Can you help me? I've attached my result at the end of the issue too.
When the context set to Differ::CONTEXT_ALL it will not show the full text on the result.
I don't notice anything unexpected with your options and sources.
Thanks for your reply. If you see my latest uploaded image, i have the result same as you. But on the left column as you can see i have many sentences that they should show on the right column as a removed text (as we don't have them more), but we can't see.
But on the left column as you can see i have many sentences that they should show on the right column as a removed text (as we don't have them more), but we can't see.
That's not what you provided in old.txt / new.txt.
To save our time, use the demo example to provide results and point out what the issue is. I won't try anything other than the demo example.