You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by hd...@apache.org on 2013/01/14 11:50:06 UTC

svn commit: r1432869 - /openoffice/trunk/main/i18npool/source/search/textsearch.cxx

Author: hdu
Date: Mon Jan 14 10:50:06 2013
New Revision: 1432869

URL: http://svn.apache.org/viewvc?rev=1432869&view=rev
Log:
#i121482# fix backwards regexp search for matches overlapping search start

Modified:
    openoffice/trunk/main/i18npool/source/search/textsearch.cxx

Modified: openoffice/trunk/main/i18npool/source/search/textsearch.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/i18npool/source/search/textsearch.cxx?rev=1432869&r1=1432868&r2=1432869&view=diff
==============================================================================
--- openoffice/trunk/main/i18npool/source/search/textsearch.cxx (original)
+++ openoffice/trunk/main/i18npool/source/search/textsearch.cxx Mon Jan 14 10:50:06 2013
@@ -816,9 +816,15 @@ SearchResult TextSearch::RESrchBkwrd( co
 
 	// find the last match
 	int nLastPos = 0;
+	int nFoundEnd = 0;
 	do {
 		nLastPos = pRegexMatcher->start( nIcuErr);
-	} while( pRegexMatcher->find( nLastPos + 1, nIcuErr));
+		nFoundEnd = pRegexMatcher->end( nIcuErr);
+		if( nFoundEnd >= startPos)
+			break;
+		if( nFoundEnd == nLastPos)
+			++nFoundEnd;
+	} while( pRegexMatcher->find( nFoundEnd, nIcuErr));
 
 	// find last match again to get its details
 	pRegexMatcher->find( nLastPos, nIcuErr);