src/Builder4/Editor.bjs
[app.Builder.js] / src / Builder4 / Editor.vala
index f822ae7..ccf58dd 100644 (file)
@@ -59,6 +59,11 @@ public class Editor : Object
     }
 
     // user defined functions
+    public Gee.ArrayList<int> search (string txt) {
+      var ret =  new Gee.ArrayList<int>();
+      
+      return ret;
+    }
     public   bool saveContents ()  {
         
         
@@ -67,8 +72,7 @@ public class Editor : Object
         }
         
         
-        
-        
+       
        
          
          var str = _this.buffer.toString();
@@ -99,6 +103,21 @@ public class Editor : Object
         return true;
     
     }
+    public void scroll_to_line (int line) {
+    
+       GLib.Timeout.add(500, () => {
+       
+               var buf = this.view.el.get_buffer();
+    
+               var sbuf = (Gtk.SourceBuffer) buf;
+    
+    
+               Gtk.TextIter iter;   
+               sbuf.get_iter_at_line(out iter,  line);
+               this.view.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);
+               return false;
+       });   
+    }
     public   void show (JsRender.JsRender file, JsRender.Node? node, string ptype, string key)
     {
         this.file = file;    
@@ -273,13 +292,10 @@ public class Editor : Object
 
             // init method
 
-            try { 
-                       var description =   Pango.FontDescription.from_string("monospace");
+            var description =   Pango.FontDescription.from_string("monospace");
                        description.set_size(8000);
                         this.el.override_font(description);
-                } catch (GLib.Error e) {
                 
-                }
                
                this.el.completion.add_provider(new Palete.CompletionProvider(_this));
                this.el.completion.unblock_interactive();