src/Builder4/WindowRooView.bjs
[app.Builder.js] / src / Builder4 / WindowRooView.vala
index a93b26e..53e963d 100644 (file)
@@ -1087,7 +1087,7 @@ public class Xcls_WindowRooView : Object
                     }
                     ltree.view.setCursor(tp, "editor");
                    // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); 
-                   this.nodeSelected(node);
+                   this.nodeSelected(node,false);
                     
                     // scrolling is disabled... as node selection calls scroll 10ms after it changes.
                     GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
@@ -1098,7 +1098,7 @@ public class Xcls_WindowRooView : Object
                 
                 // highlight the node..
         }
-        public void nodeSelected (JsRender.Node? sel, bool scroll =false) {
+        public void nodeSelected (JsRender.Node? sel, bool scroll ) {
           
             
           
@@ -1203,7 +1203,18 @@ public class Xcls_WindowRooView : Object
         }
         public void loadFile ( ) {
             this.loading = true;
+            
+            
+            // get the cursor and scroll position....
             var buf = this.el.get_buffer();
+               var cpos = buf.cursor_position;
+            
+        
+           
+            var vadj = this.el.get_vadjustment();
+           
+            
+         
             buf.set_text("",0);
             var sbuf = (Gtk.SourceBuffer) buf;
         
@@ -1235,6 +1246,16 @@ public class Xcls_WindowRooView : Object
             sbuf.remove_source_marks (start, end, null); // remove all marks..
             
             
+            while(Gtk.events_pending()) {
+                Gtk.main_iteration();
+            }
+            
+            Gtk.TextIter cpos_iter;
+            buf.get_iter_at_offset(out cpos_iter, cpos);
+            buf.place_cursor(cpos_iter); 
+            
+            this.el.set_vadjustment(vadj);
+            
             
             
             this.loading = false;