Kaydet (Commit) ce91f3c1 authored tarafından Eike Rathke's avatar Eike Rathke

similar to searchForward() use the correct offsets, tdf#94810 related

Change-Id: Icb5a45acaad9029e0998594de8b3dc2e9211866e
üst 54336499
......@@ -404,15 +404,18 @@ SearchResult TextSearch::searchBackward( const OUString& searchStr, sal_Int32 st
for ( sal_Int32 k = 0; k < nGroups; k++ )
{
const sal_Int32 nStart = sres.startOffset[k];
if (endPos > 0 || nStart > 0)
assert(nStart >= 0);
if (nStart > 0)
sres.startOffset[k] = offset[(nStart <= nOffsets ? nStart : nOffsets) - 1] + 1;
else
sres.startOffset[k] = offset[0];
// JP 20.6.2001: end is ever exclusive and then don't return
// the position of the next character - return the
// next position behind the last found character!
// "a b c" find "b" must return 2,3 and not 2,4!!!
const sal_Int32 nStop = sres.endOffset[k];
if (endPos > 0 || nStop > 0)
sres.endOffset[k] = (nStop < nOffsets ? offset[nStop] : (offset[nOffsets - 1] + 1));
assert(nStop >= 0);
sres.endOffset[k] = (nStop < nOffsets ? offset[nStop] : (offset[nOffsets - 1] + 1));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment