[Monodevelop-patches-list] r1729 - in trunk/MonoDevelop: . src src/AddIns/DisplayBindings/SourceEditor src/AddIns/DisplayBindings/SourceEditor/Gui src/AddIns/DisplayBindings/SourceEditor/Search src/AddIns/Misc/StartPage src/AddIns/prj2make-sharp-lib src/Libraries/Gdl

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Wed Jun 9 23:00:08 EDT 2004


Author: jba
Date: 2004-06-09 23:00:07 -0400 (Wed, 09 Jun 2004)
New Revision: 1729

Modified:
   trunk/MonoDevelop/ChangeLog
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DefaultFind.cs
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/SourceEditor.prjx
   trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.prjx
   trunk/MonoDevelop/src/AddIns/prj2make-sharp-lib/Prj2MakeSharp.prjx
   trunk/MonoDevelop/src/Libraries/Gdl/Makefile.Gdl
   trunk/MonoDevelop/src/Makefile.solution.MonoDevelop
Log:
find-in-files on non-utf8 text files fix

Modified: trunk/MonoDevelop/ChangeLog
===================================================================
--- trunk/MonoDevelop/ChangeLog	2004-06-09 18:55:58 UTC (rev 1728)
+++ trunk/MonoDevelop/ChangeLog	2004-06-10 03:00:07 UTC (rev 1729)
@@ -1,3 +1,7 @@
+2004-06-10 John Bouantoun (jba-mono at optusnet.com.au)
+	* Numerous *.prjx in MonoDevelop solution: Changed them to not
+	search folders for new files on load.
+
 2004-06-08 Iain McCoy <iain at mccoy.id.au>
 
 	* Makefile.am: don't clobber LD_LIBRARY_PATH in the make run target

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2004-06-09 18:55:58 UTC (rev 1728)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2004-06-10 03:00:07 UTC (rev 1729)
@@ -1,3 +1,10 @@
+2004-06-10  John BouAntoun  <jba-mono at optusnet.com.au>
+	* Gui/SourceEditorBuffer.cs Added g_utf8_validate check to LoadText, 
+	refactored LoadText and LoadFile usage
+	* Search/DefaultFind.cs Added check for empty string .Text property
+	of a source buffer in find routine. BuildTextIterator hangs on 
+	empty strings for some reason
+
 2004-06-06  John Luke  <jluke at cfl.rr.com>
 
 	* Gui/SourceEditorWidget.cs: set PolicyType.Automatic for scrolling

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-06-09 18:55:58 UTC (rev 1728)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-06-10 03:00:07 UTC (rev 1729)
@@ -195,42 +195,52 @@
 		{
 			StreamReader sr = System.IO.File.OpenText (file);
 			LoadText (sr.ReadToEnd (), mime);		
-			sr.Close ();
-			Modified = false;
+			sr.Close ();			
 		}
 		
 		public void LoadFile (string file)
 		{
+			//Debug
+			Console.WriteLine("LoadFile (\"" +  file + "\")");
 			using (NoUndo n = new NoUndo (this)) {
 				StreamReader sr = System.IO.File.OpenText (file);
-				Text = sr.ReadToEnd ();
+				LoadText(sr.ReadToEnd ());
 				sr.Close ();
 			}
-			
-			Modified = false;
-			ScrollToTop ();
 		}
+
+		// needed to make sure the text is valid
+		[DllImport("glib-2.0")]
+		static extern bool g_utf8_validate(string text, int textLength, IntPtr end);
 		
 		public void LoadText (string text, string mime)
 		{
 			SourceLanguage lang = slm.GetLanguageFromMimeType (mime);
 			if (lang != null) 
 				Language = lang;
-			
-			using (NoUndo n = new NoUndo (this))
-				Text = text;
-			
-			Modified = false;
-			ScrollToTop ();
+
+			LoadText(text);
 		}
 		
+
+		//
+		// NOTE: Text is set to null if the file could not be loaded (i.e. not valid utf8 text
+		//
 		public void LoadText (string text)
 		{
-			using (NoUndo n = new NoUndo (this))
-				Text = text;
-			
+			if (g_utf8_validate (text, text.Length, IntPtr.Zero))
+			{
+				using (NoUndo n = new NoUndo (this))
+					Text = text;
+			}
+			else
+			{
+				using (NoUndo n = new NoUndo (this))
+					Text = null;
+			}
+
 			Modified = false;
-			ScrollToTop ();
+			ScrollToTop ();			
 		}
 
 		void ScrollToTop ()
@@ -668,7 +678,12 @@
 		{
 			SourceEditorBuffer buff = new SourceEditorBuffer ();
 			buff.LoadFile (filename);
-			return buff;
+			// don't return a buffer that couldn't load the file
+			if (buff.Text == null) {
+				return null;
+			} else {
+				return buff;
+			}
 		}
 
 #endregion

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DefaultFind.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DefaultFind.cs	2004-06-09 18:55:58 UTC (rev 1728)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Search/DefaultFind.cs	2004-06-10 03:00:07 UTC (rev 1729)
@@ -110,7 +110,9 @@
 			if (documentIterator.MoveForward()) {
 				info = documentIterator.Current;
 				// document is valid for searching -> set iterator & fileName
-				if (info != null && info.TextBuffer != null && info.EndOffset >= 0 && info.EndOffset < info.TextBuffer.Length) {
+				// add check to make sure text != string.Empty since this was causing BuildTextIterator to hang (JBA)
+				if (info != null && info.TextBuffer != null && info.TextBuffer.Text != string.Empty && info.EndOffset >= 0 && info.EndOffset < info.TextBuffer.Length) {
+					// TODO: figure out why BuildTextIterator hangs if info.TextBUffer.Text is empty string
 					textIterator = textIteratorBuilder.BuildTextIterator(info);
 				} else {
 					textIterator = null;

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/SourceEditor.prjx
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/SourceEditor.prjx	2004-06-09 18:55:58 UTC (rev 1728)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/SourceEditor.prjx	2004-06-10 03:00:07 UTC (rev 1729)
@@ -1,4 +1,4 @@
-<Project name="SourceEditor" description="" newfilesearch="OnLoad" enableviewstate="True" version="1.1" projecttype="C#">
+<Project name="SourceEditor" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#">
   <Contents>
     <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
     <File name="./AssemblyInfo.cs.in" subtype="Code" buildaction="Exclude" dependson="" data="" />

Modified: trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.prjx
===================================================================
--- trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.prjx	2004-06-09 18:55:58 UTC (rev 1728)
+++ trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.prjx	2004-06-10 03:00:07 UTC (rev 1729)
@@ -1,4 +1,4 @@
-<Project name="StartPage" description="" newfilesearch="OnLoad" enableviewstate="True" version="1.1" projecttype="C#">
+<Project name="StartPage" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#">
   <Contents>
     <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
     <File name="./AssemblyInfo.cs.in" subtype="Code" buildaction="Exclude" dependson="" data="" />

Modified: trunk/MonoDevelop/src/AddIns/prj2make-sharp-lib/Prj2MakeSharp.prjx
===================================================================
--- trunk/MonoDevelop/src/AddIns/prj2make-sharp-lib/Prj2MakeSharp.prjx	2004-06-09 18:55:58 UTC (rev 1728)
+++ trunk/MonoDevelop/src/AddIns/prj2make-sharp-lib/Prj2MakeSharp.prjx	2004-06-10 03:00:07 UTC (rev 1729)
@@ -1,4 +1,4 @@
-<Project name="Prj2MakeSharp" description="" newfilesearch="OnLoad" enableviewstate="True" version="1.1" projecttype="C#">
+<Project name="Prj2MakeSharp" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#">
   <Contents>
     <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
     <File name="./AssemblyInfo.cs.in" subtype="Code" buildaction="Exclude" dependson="" data="" />

Modified: trunk/MonoDevelop/src/Libraries/Gdl/Makefile.Gdl
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/Makefile.Gdl	2004-06-09 18:55:58 UTC (rev 1728)
+++ trunk/MonoDevelop/src/Libraries/Gdl/Makefile.Gdl	2004-06-10 03:00:07 UTC (rev 1729)
@@ -31,7 +31,7 @@
 
 Gdl.dll: $(SOURCES)
 	mcs $(MCS_OPTIONS) -target:library -out:"Gdl.dll" $(PKG_REFERENCES_BUILD) $(SOURCES) \
-	&& cp "Gdl.dll" ./build/bin
+	&& cp "Gdl.dll" ../../build/bin
 
 clean:
 	rm -f Gdl.dll

Modified: trunk/MonoDevelop/src/Makefile.solution.MonoDevelop
===================================================================
--- trunk/MonoDevelop/src/Makefile.solution.MonoDevelop	2004-06-09 18:55:58 UTC (rev 1728)
+++ trunk/MonoDevelop/src/Makefile.solution.MonoDevelop	2004-06-10 03:00:07 UTC (rev 1729)
@@ -3,14 +3,14 @@
 
 OUTPUTDIR := ./build/bin
 
-all: depcheck __init Makefile.SharpAssembly.all Makefile.SharpRefactory.all Makefile.MonoDevelop.Core.all Makefile.MonoDevelop.Gui.Utils.all Makefile.MonoDevelop.Gui.Widgets.all Makefile.MonoDevelop.Base.all Makefile.MonoDevelop.all Makefile.SourceEditor.all Makefile.CSharpBinding.all Makefile.JavaBinding.all Makefile.NemerleBinding.all Makefile.ILAsmBinding.all Makefile.StartPage.all Makefile.Prj2MakeSharp.all 
+all: depcheck __init Makefile.SharpAssembly.all Makefile.SharpRefactory.all Makefile.MonoDevelop.Core.all Makefile.MonoDevelop.Gui.Utils.all Makefile.MonoDevelop.Gui.Widgets.all Makefile.MonoDevelop.Base.all Makefile.MonoDevelop.all Makefile.SourceEditor.all Makefile.CSharpBinding.all Makefile.JavaBinding.all Makefile.NemerleBinding.all Makefile.ILAsmBinding.all Makefile.StartPage.all Makefile.Prj2MakeSharp.all Makefile.Gdl.all 
 
 __init:
 	mkdir -p $(OUTPUTDIR)
 
-clean: Makefile.SharpAssembly.clean Makefile.SharpRefactory.clean Makefile.MonoDevelop.Core.clean Makefile.MonoDevelop.Gui.Utils.clean Makefile.MonoDevelop.Gui.Widgets.clean Makefile.MonoDevelop.Base.clean Makefile.MonoDevelop.clean Makefile.SourceEditor.clean Makefile.CSharpBinding.clean Makefile.JavaBinding.clean Makefile.NemerleBinding.clean Makefile.ILAsmBinding.clean Makefile.StartPage.clean Makefile.Prj2MakeSharp.clean 
+clean: Makefile.SharpAssembly.clean Makefile.SharpRefactory.clean Makefile.MonoDevelop.Core.clean Makefile.MonoDevelop.Gui.Utils.clean Makefile.MonoDevelop.Gui.Widgets.clean Makefile.MonoDevelop.Base.clean Makefile.MonoDevelop.clean Makefile.SourceEditor.clean Makefile.CSharpBinding.clean Makefile.JavaBinding.clean Makefile.NemerleBinding.clean Makefile.ILAsmBinding.clean Makefile.StartPage.clean Makefile.Prj2MakeSharp.clean Makefile.Gdl.clean 
 
-depcheck: Makefile.SharpAssembly.depcheck Makefile.SharpRefactory.depcheck Makefile.MonoDevelop.Core.depcheck Makefile.MonoDevelop.Gui.Utils.depcheck Makefile.MonoDevelop.Gui.Widgets.depcheck Makefile.MonoDevelop.Base.depcheck Makefile.MonoDevelop.depcheck Makefile.SourceEditor.depcheck Makefile.CSharpBinding.depcheck Makefile.JavaBinding.depcheck Makefile.NemerleBinding.depcheck Makefile.ILAsmBinding.depcheck Makefile.StartPage.depcheck Makefile.Prj2MakeSharp.depcheck 
+depcheck: Makefile.SharpAssembly.depcheck Makefile.SharpRefactory.depcheck Makefile.MonoDevelop.Core.depcheck Makefile.MonoDevelop.Gui.Utils.depcheck Makefile.MonoDevelop.Gui.Widgets.depcheck Makefile.MonoDevelop.Base.depcheck Makefile.MonoDevelop.depcheck Makefile.SourceEditor.depcheck Makefile.CSharpBinding.depcheck Makefile.JavaBinding.depcheck Makefile.NemerleBinding.depcheck Makefile.ILAsmBinding.depcheck Makefile.StartPage.depcheck Makefile.Prj2MakeSharp.depcheck Makefile.Gdl.depcheck 
 
 run: all
 	cd $(OUTPUTDIR) && mono MonoDevelop.exe
@@ -57,3 +57,6 @@
 Makefile.Prj2MakeSharp.%:
 	@cd ./AddIns/prj2make-sharp-lib && $(MAKE) -f $(subst .$*,,$@) $*
 
+Makefile.Gdl.%:
+	@cd ./Libraries/Gdl && $(MAKE) -f $(subst .$*,,$@) $*
+




More information about the Monodevelop-patches-list mailing list