src/Builder4/WindowRooView.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 27 Jul 2016 08:59:37 +0000 (16:59 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 27 Jul 2016 08:59:37 +0000 (16:59 +0800)
src/Builder4/WindowRooView.vala

src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala

index 969db41..4e09f52 100644 (file)
          "items" : [
           {
            "listeners" : {
-            "changed" : " () => {\n \n\n    // check syntax??\n    // ??needed..??\n   // _this.save_button.el.sensitive = true;\n    ///?? has changed occured during loading?\n    \n    // only trigger this if \n    \n    \n    \n    \n    if (_this.sourceview.loading) {\n\t\treturn;\n\t}\n\t\n\n\t\n    print(\"- PREVIEW EDITOR CHANGED--\");\n\n    this.dirty = true;  \n    this.checkSyntax(); // this calls backs and highlights errors.. in theory...  \n\n\n\n\tif (!_this.sourceview.button_is_pressed && !_this.sourceview.key_is_pressed) {\n\t\tprint(\"button or key not pressed to generate change?!\\n\");\n\t\treturn;\n\t}\n\t\t\n    \n\t// what are we editing??\n\tif (null == _this.sourceview.node_selected || _this.sourceview.prop_selected.length  < 1) {\n\t\treturn;\n\t}\n\t\n\t// find the colon on the first line...\n\t\n\tif (_this.sourceview.editable_start_pos > -1) {\n\t\t\n\t\tvar buf = (Gtk.SourceBuffer)_this.sourceview.el.get_buffer();\n\t\t\n        //print(\"cursor changed : %d\\n\", buf.cursor_position);\n        Gtk.TextIter spos,epos;\n        buf.get_iter_at_offset(out spos, _this.sourceview.editable_start_pos);\n        buf.get_iter_at_offset(out epos, _this.sourceview.editable_start_pos);\n \t\tprint(\"Start Offset = %d/%d\\n\", spos.get_line(), spos.get_offset());\n\t\tvar gotit= false;\n\t\tfor (var i =0; i < 10; i++) {\n\t\t\tif (!buf.forward_iter_to_source_mark (epos, \"grey\")) {\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (epos.get_offset() == spos.get_offset()) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tgotit= true;\n\t\t\tbreak;\n\t\t}\n\t\n\t\tif (gotit) {\n\t \t\tprint(\"End Offset = %d/%d\\n\", epos.get_line(), epos.get_offset());\n\t\t\t// get the pos...\n\t\t\t// in theory the last char will be '}' or '},' .. or ','\n\t\t\t// we should chop the ',' of the end...\n\t\t\tvar str = buf.get_text(spos, epos, false);\n\t\t\tprint(\"got string\\n%s\\n\", str);\n\t\t\n\t\t}\n\t}\n    return ;\n}\n\n \n"
+            "changed" : " () => {\n \n\n    // check syntax??\n    // ??needed..??\n   // _this.save_button.el.sensitive = true;\n    ///?? has changed occured during loading?\n    \n    // only trigger this if \n    \n    \n    \n    \n    if (_this.sourceview.loading) {\n\t\treturn;\n\t}\n\t\n\n\t\n    print(\"- PREVIEW EDITOR CHANGED--\");\n\n    this.dirty = true;  \n    this.checkSyntax(); // this calls backs and highlights errors.. in theory...  \n\n\n\n\tif (!_this.sourceview.button_is_pressed && !_this.sourceview.key_is_pressed) {\n\t\tprint(\"button or key not pressed to generate change?!\\n\");\n\t\treturn;\n\t}\n\t\t\n    \n\t// what are we editing??\n\tif (null == _this.sourceview.node_selected || _this.sourceview.prop_selected.length  < 1) {\n\t\treturn;\n\t}\n\t\n\t// find the colon on the first line...\n\t\n\tif (_this.sourceview.editable_start_pos > -1) {\n\t\t\n\t\tvar buf = (Gtk.SourceBuffer)_this.sourceview.el.get_buffer();\n\t\t\n        //print(\"cursor changed : %d\\n\", buf.cursor_position);\n        Gtk.TextIter spos,epos;\n        buf.get_iter_at_offset(out spos, _this.sourceview.editable_start_pos);\n        buf.get_iter_at_offset(out epos, _this.sourceview.editable_start_pos); // initialize epos..\n        \n        var gotit= false;\n        var line = spos.get_line();\n        var endline = buf.get_line_count();\n        while (line < endline) {\n    \t\tline++;\n\t        buf.get_iter_at_line(out epos, line);\n\t        if (buf.get_source_marks_at_line(line, \"grey\")) {\n\t\t        buf.get_iter_at_line(out epos, line);\t    \t\t\n\t    \t\tgotit=true;\n\t    \t\tbreak;\n    \t\t}\n\t\t}\n        \n \t\tif (gotit) {\n\t \t\tprint(\"End Offset = %d/%d\\n\", epos.get_line(), epos.get_offset());\n\t\t\t// get the pos...\n\t\t\t// in theory the last char will be '}' or '},' .. or ','\n\t\t\t// we should chop the ',' of the end...\n\t\t\tvar str = buf.get_text(spos, epos, false);\n\t\t\tprint(\"got string\\n%s\\n\", str);\n\t\t\n\t\t}\n\t}\n    return ;\n}\n\n \n"
            },
            "bool dirty" : false,
            "int error_line" : "-1",
index e16ce76..a74eb0d 100644 (file)
@@ -1552,21 +1552,22 @@ public class Xcls_WindowRooView : Object
                     //print("cursor changed : %d\n", buf.cursor_position);
                     Gtk.TextIter spos,epos;
                     buf.get_iter_at_offset(out spos, _this.sourceview.editable_start_pos);
-                    buf.get_iter_at_offset(out epos, _this.sourceview.editable_start_pos);
-                       print("Start Offset = %d/%d\n", spos.get_line(), spos.get_offset());
-                       var gotit= false;
-                       for (var i =0; i < 10; i++) {
-                               if (!buf.forward_iter_to_source_mark (epos, "grey")) {          
-                                       break;
-                               }
-                               if (epos.get_offset() == spos.get_offset()) {
-                                       continue;
-                               }
-                               gotit= true;
-                               break;
+                    buf.get_iter_at_offset(out epos, _this.sourceview.editable_start_pos); // initialize epos..
+                    
+                    var gotit= false;
+                    var line = spos.get_line();
+                    var endline = buf.get_line_count();
+                    while (line < endline) {
+                               line++;
+                       buf.get_iter_at_line(out epos, line);
+                       if (buf.get_source_marks_at_line(line, "grey")) {
+                               buf.get_iter_at_line(out epos, line);                   
+                               gotit=true;
+                               break;
+                               }
                        }
-               
-                       if (gotit) {
+                    
+                       if (gotit) {
                                print("End Offset = %d/%d\n", epos.get_line(), epos.get_offset());
                                // get the pos...
                                // in theory the last char will be '}' or '},' .. or ','