Typo in "apply unmatched penalty"
bubnikv opened this issue · comments
Vojtěch Bubník commented
// Apply unmatched penalty
It is
int unmatched = (int)(str - strBegin) - nextMatch;
where nextMatch is a pointer into matches, so the expression above mixes apples with oranges. IMHO it should be
int unmatched = (int)(str - strBegin) - matches[nextMatch-1] + 1;
Thanks for a great library, we are going to use it in
https://www.prusa3d.com/prusaslicer/
https://github.com/prusa3d/PrusaSlicer
Vojtěch Bubník commented
Forget it, I did not understand the condition. It calculates number of unmatched characters, however my proposal while being valid as well counts the number of unmatched characters after the last matched character.