tdf#94810: fix reverse offset mapping
With simple transliteration, TextSearch::searchForward used to use whole string to perform the search, then started to create substring to search. But it left the precautions from commit c00601da by Eike Rathke: searching for $ may actually return a result set pointing behind the search string which it does with the ICU regex engine. The precaution made it to skip reverse mapping if index was 0. Commit 9aae521b by Michael Stahl didn't consider the case when nStop is 0, and startPos > 0. Then it tried to get offset[-1]. Anyway, using value of startPos in those conditions seems illogical. Removed those precautions (and made assertions for that). Fixed handling zero indexes. Reviewed-on: https://gerrit.libreoffice.org/19840Tested-by:Jenkins <ci@libreoffice.org> Reviewed-by:
Eike Rathke <erack@redhat.com> Tested-by:
Eike Rathke <erack@redhat.com> (cherry picked from commit 4cf1d290) remove comment that makes no sense, tdf#94810 follow-up nStart should not become <0, not even when searching for $ end. (cherry picked from commit 67ab2ce3) similar to searchForward() use the correct offsets, tdf#94810 related (cherry picked from commit ce91f3c1) Change-Id: I2066abc51fff7fb7323bc7f6198bdea06439d4f3 79586471f1a7908372fa3ee044a6f66499b1790f cb5a45acaad9029e0998594de8b3dc2e9211866e Reviewed-on: https://gerrit.libreoffice.org/20136Tested-by:
Jenkins <ci@libreoffice.org> Reviewed-by:
Mike Kaganski <mikekaganski@hotmail.com> (cherry picked from commit 028d7d84)
Showing
Please
register
or
sign in
to comment