Fix #8103 - updating of tree
[roobuilder] / src / Builder4 / Editor.bjs
index 365c280..890179b 100644 (file)
               "        _this.file.setSource(str);",
               "\t    BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
               "    \t_this.file.getLanguageServer().document_change(_this.file);",
-              "",
+              "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
               "        _this.file.setSource(oldcode);",
               "        ",
               "\t\t ",
           "\tforeach(var sym in syms) {",
           "\t\t_this.navliststore.el.append(sym);",
           "\t}",
-          "\t",
+          "\tthis.last_selected_line = -1;",
+          "\tGLib.Idle.add(() => {",
+          "",
+          "\t\tGtk.TextIter iter;",
+          "\t\t_this.buffer.el.get_iter_at_offset (",
+          "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
+          "\t\t",
+          "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
+          "\t\t\t\titer.get_line_offset());",
+          "\t\tthis.updateSelectedLine(",
+          "\t\t\t\t(uint)iter.get_line(),",
+          "\t\t\t\t(uint)iter.get_line_offset()",
+          "\t\t);",
+          "\t\treturn false;",
+          "\t});",
           "",
           "}"
          ],
     "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
     "{",
     "    this.reset();",
+    "    if (this.file != null) {",
+    "    \tthis.file.navigation_tree_updated.disconnect(",
+    "    \t\t_this.navigation.show",
+    "    \t);",
+    "    }",
     "    this.file = file;    ",
-    "    ",
+    "    this.file.navigation_tree_updated.connect(",
+    "\t\t_this.navigation.show",
+    "\t);",
     "    if (file.xtype != \"PlainFile\") {",
     "    \tthis.prop = prop;",
     "        this.node = node;",
     "    ",
     "    } else {",
     "        this.view.load(        file.toSource() );",
-    "         this.updateErrorMarks();",
+    "        this.updateErrorMarks();",
     "        this.close_btn.el.hide();",
     "        var ls = file.getLanguageServer();",
-    "        ls.documentSymbols.begin(file, (a,o) => {",
-    "        \t_this.navigation.show(ls.documentSymbols.end(o)); ",
-    "        });",
+    "        ls.queueDocumentSymbols(file);",
+    "        ////ls.documentSymbols.begin(file, (a,o) => {",
+    "        //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
+    "       //});",
     "        //documentSymbols",
     "        ",
     "    }",