[Monodevelop-patches-list] r1469 - in trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor: . Gui

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Fri Apr 16 16:39:00 EDT 2004


Author: tberman
Date: 2004-04-16 16:39:00 -0400 (Fri, 16 Apr 2004)
New Revision: 1469

Modified:
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
Log:
on load, jump and grab focus


Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2004-04-16 20:15:37 UTC (rev 1468)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2004-04-16 20:39:00 UTC (rev 1469)
@@ -1,3 +1,8 @@
+2004-04-16  Todd Berman  <tberman at sevenl.net>
+
+	* Gui/SourceEditorBuffer.cs: On load, place the cursor at the top
+	and grab focus.
+
 2004-04-12  Nick Drochak <ndrochak at gol.com>
 
 	* Gui/SourceEditorView.cs: Use white space already on the line to

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-04-16 20:15:37 UTC (rev 1468)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorBuffer.cs	2004-04-16 20:39:00 UTC (rev 1469)
@@ -199,6 +199,7 @@
 				Text = File.OpenText (file).ReadToEnd ();
 			
 			Modified = false;
+			ScrollToTop ();
 		}
 		
 		public void LoadText (string text, string mime)
@@ -211,6 +212,7 @@
 				Text = text;
 			
 			Modified = false;
+			ScrollToTop ();
 		}
 		
 		public void LoadText (string text)
@@ -219,7 +221,23 @@
 				Text = text;
 			
 			Modified = false;
+			ScrollToTop ();
 		}
+
+		void ScrollToTop ()
+		{
+			PlaceCursor (StartIter);
+			if (View != null) {
+				View.ScrollMarkOnscreen (InsertMark);
+				Gtk.Timeout.Add (20, new Gtk.Function (changeFocus));
+			}
+		}
+
+		bool changeFocus ()
+		{
+			View.GrabFocus ();
+			return false;
+		}
 		
 		public void Save (string fileName)
 		{




More information about the Monodevelop-patches-list mailing list