The result: last character missing from the compare.
@totya
I have found the problem with the last char in TDiff in the
function Execute(const s1, s2: string): boolean;
//finally, append any trailing matches onto compareList ...
with FLastCompareRec do
begin
AddChangeChr(oldIndex1,len1{len1Minus1}-oldIndex1, ckNone); //<DomingoGP SOLVES BUG: strings index are 1 based not 0 based.
end;
Also I have modified the unit so the desired string type can be easily changed and I have set as unicodestring by default for FPC.
if you want you can try the demo provided, with modified TDiff2.pas. It works reasonably well for me. Anyway, as Martin said, unicode characters can consist on several widechars or codepoints, in which case it won't work as expected. As well as this it works with the most common characters like accented vowels áéíóú ñ ç.
Unicode is too complicated to cover all possible cases
.
The
https://github.com/DomingoGP/lazIdeDiffCompareFiles component don't compare strings, so it is not affected by this bug.
Sorry for my bad english.