Hello, a very good feature would be to get reverse diff opcodes.
I would like to log all changes in my forum (on subject or responses). But I don't keep the old version, only the newer. So I would like to compute old versions from the last version, not the opposite.
I try to switch arguments when calling FineDiff::getDiffOpcodes($from, $to) :
$firstVersion = "Test 123 - Heloa";
$newVersion = "Test 124 - Hello";
$opdiff = FineDiff::getDiffOpcodes($newVersion, $firstVersion)
But when I display, the difference (FineDiff::renderDiffToHTMLFromOpcodes), the modification are reversed (ins & del). So I tried something like :
$result = FineDiff::renderDiffToHTMLFromOpcodes($text, $opdiff);
// Replace ins by del & del by ins
$result = strtr($result, array('<del>' => '<ins>', '</del>' => '</ins>', '<ins>' => '<del>', '</ins>' => '</del>'));
// Swap ins & del
$result = preg_replace('#(<ins>.+?</ins>)(\s*)(<del>.+?</del>)#s', '$3$2$1', $result);
But, it's very ugly...
Could you do function FineDiff::getReverseDiffOpcodes for this case?
Thanks in advance,
Best Regards, Max