[Monodevelop-patches-list] r2552 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Search Search/SearchStrategy

Todd Berman <tberman@sevenl.net> tberman at mono-cvs.ximian.com
Sat May 21 15:42:14 EDT 2005


Author: tberman
Date: 2005-05-21 15:42:14 -0400 (Sat, 21 May 2005)
New Revision: 2552

Modified:
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceInFilesManager.cs
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/RegExSearchStrategy.cs
Log:
2005-05-21  Todd Berman  <tberman at off.net>

	* Search/SearchReplaceManager.cs:
	* Search/SearchStrategy/RegExSearchStrategy.cs:
	* Search/SearchReplaceInFilesManager.cs:
	Fix #74966 and display a meaningful error message.



Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2005-05-21 17:31:57 UTC (rev 2551)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2005-05-21 19:42:14 UTC (rev 2552)
@@ -1,3 +1,10 @@
+2005-05-21  Todd Berman  <tberman at off.net>
+
+	* Search/SearchReplaceManager.cs:
+	* Search/SearchStrategy/RegExSearchStrategy.cs:
+	* Search/SearchReplaceInFilesManager.cs:
+	Fix #74966 and display a meaningful error message.
+
 2005-05-20  Jacob Ilsø Christensen  <jacobilsoe at gmail.com>
 
 	* Gui/SourceEditorView.cs: Fixed problem with monodoc on words followed by a newline.

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceInFilesManager.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceInFilesManager.cs	2005-05-21 17:31:57 UTC (rev 2551)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceInFilesManager.cs	2005-05-21 19:42:14 UTC (rev 2552)
@@ -100,7 +100,12 @@
 			InitializeDocumentIterator(null, null);
 			InitializeSearchStrategy(null, null);
 			find.Reset();
-			find.SearchStrategy.CompilePattern(searchOptions);
+			try {
+				find.SearchStrategy.CompilePattern(searchOptions);
+			} catch {
+				Runtime.MessageService.ShowMessage (GettextCatalog.GetString ("Search pattern is invalid"), DialogPointer);
+				return false;
+			}
 			
 			currentFileName = String.Empty;
 			currentDocument = null;

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs	2005-05-21 17:31:57 UTC (rev 2551)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs	2005-05-21 19:42:14 UTC (rev 2552)
@@ -96,7 +96,12 @@
 				textArea.Buffer.PlaceCursor (textArea.Buffer.GetIterAtMark (textArea.Buffer.InsertMark));
 			}
 			find.Reset();
-			find.SearchStrategy.CompilePattern(searchOptions);
+			try {
+				find.SearchStrategy.CompilePattern(searchOptions);
+			} catch {
+				Runtime.MessageService.ShowMessage (GettextCatalog.GetString ("Search pattern is invalid"), DialogPointer);
+				return;
+			}
 			while (true) {
 				ISearchResult result = SearchReplaceManager.find.FindNext(searchOptions);
 				
@@ -127,7 +132,12 @@
 				textArea.Buffer.PlaceCursor (textArea.Buffer.GetIterAtMark (textArea.Buffer.InsertMark));
 			}
 			find.Reset();
-			find.SearchStrategy.CompilePattern(searchOptions);
+			try {
+				find.SearchStrategy.CompilePattern(searchOptions);
+			} catch {
+				Runtime.MessageService.ShowMessage (GettextCatalog.GetString ("Search pattern is invalid"), DialogPointer);
+				return;
+			}
 			
 			while (true) {
 				ISearchResult result = SearchReplaceManager.find.FindNext(SearchReplaceManager.searchOptions);
@@ -168,7 +178,13 @@
 			else
 				find.Reset ();
 				
-			find.SearchStrategy.CompilePattern(searchOptions);
+			try {
+				find.SearchStrategy.CompilePattern(searchOptions);
+			} catch {
+				Runtime.MessageService.ShowMessage (GettextCatalog.GetString ("Search pattern is invalid"), DialogPointer);
+				return;
+			}
+
 			ISearchResult result = find.FindNext(searchOptions);
 			
 			if (result == null) {

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/RegExSearchStrategy.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/RegExSearchStrategy.cs	2005-05-21 17:31:57 UTC (rev 2551)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchStrategy/RegExSearchStrategy.cs	2005-05-21 19:42:14 UTC (rev 2552)
@@ -29,7 +29,8 @@
 		public ISearchResult FindNext(ITextIterator textIterator, SearchOptions options)
 		{
 			if (!textIterator.MoveAhead(1)) return null;
-			
+			if (regex == null) return null;
+
 			int pos = textIterator.Position;
 			string document = textIterator.ReadToEnd ();
 			textIterator.Position = pos;




More information about the Monodevelop-patches-list mailing list