Browse Source

Fixed a horrible performance issue in RegExSearchStrategy. (SD2-1323: Regex search across SharpDevelop solution takes a long time)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2489 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
8218830b3b
  1. 10
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/RegExSearchStrategy.cs

10
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/RegExSearchStrategy.cs

@ -39,8 +39,8 @@ namespace SearchAndReplace @@ -39,8 +39,8 @@ namespace SearchAndReplace
while (textIterator.MoveAhead(1)) {
Match m = regex.Match(document, textIterator.Position);
if (m == null || m.Index <= 0 || m.Length <= 0) {
if (m == null || !m.Success) {
break;
} else {
int delta = m.Index - textIterator.Position;
if (delta <= 0 || textIterator.MoveAhead(delta)) {
@ -60,8 +60,8 @@ namespace SearchAndReplace @@ -60,8 +60,8 @@ namespace SearchAndReplace
while (textIterator.MoveAhead(1) && TextSelection.IsInsideRange(textIterator.Position, offset, length)) {
Match m = regex.Match(document, textIterator.Position);
if (m == null || m.Index <= 0 || m.Length <= 0) {
if (m == null || !m.Success) {
break;
} else {
int delta = m.Index - textIterator.Position;
if (delta <= 0 || textIterator.MoveAhead(delta)) {
@ -79,7 +79,7 @@ namespace SearchAndReplace @@ -79,7 +79,7 @@ namespace SearchAndReplace
return null;
}
private class RegexSearchResult : SearchResult
private sealed class RegexSearchResult : SearchResult
{
Match m;

Loading…
Cancel
Save