From 341a8924ca4d4773d1aa2ea4ac389c77fd36ca24 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 18 Apr 2007 19:39:04 +0000 Subject: [PATCH] Fixed bug introduced in regex search in last revision. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2490 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Engine/SearchStrategy/RegExSearchStrategy.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/RegExSearchStrategy.cs b/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/RegExSearchStrategy.cs index 382f7fd30f..86a75a9135 100644 --- a/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/RegExSearchStrategy.cs +++ b/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/RegExSearchStrategy.cs @@ -40,7 +40,10 @@ namespace SearchAndReplace while (textIterator.MoveAhead(1)) { Match m = regex.Match(document, textIterator.Position); if (m == null || !m.Success) { - break; + while (textIterator.Position < document.Length - 1) { + if (!textIterator.MoveAhead(1)) + return null; + } } else { int delta = m.Index - textIterator.Position; if (delta <= 0 || textIterator.MoveAhead(delta)) { @@ -61,7 +64,10 @@ namespace SearchAndReplace while (textIterator.MoveAhead(1) && TextSelection.IsInsideRange(textIterator.Position, offset, length)) { Match m = regex.Match(document, textIterator.Position); if (m == null || !m.Success) { - break; + while (textIterator.Position < document.Length - 1) { + if (!textIterator.MoveAhead(1)) + return null; + } } else { int delta = m.Index - textIterator.Position; if (delta <= 0 || textIterator.MoveAhead(delta)) {