sbuf.remove_source_marks (start, end, null); // remove all marks..
GLib.Timeout.add(500, () => {
-
- print("RESORTING cursor to = %d\n", cpos);
+
+ print("RESORTING cursor to = %d\n", cpos);
Gtk.TextIter cpos_iter;
buf.get_iter_at_offset(out cpos_iter, cpos);
buf.place_cursor(cpos_iter);
this.el.get_vadjustment().set_value(vadj_pos);;
+
+
this.onCursorChanged();
+
+
_this.buffer.checkSyntax();
return false;
});
}
public void highlightErrorsJson (string type, Json.Object obj) {
- Gtk.TextIter start;
- Gtk.TextIter end;
-
- var buf = this.el.get_buffer();
- var sbuf = (Gtk.SourceBuffer)buf;
- buf.get_bounds (out start, out end);
-
- sbuf.remove_source_marks (start, end, type);
-
-
- // we should highlight other types of errors..
-
- if (!obj.has_member(type)) {
- print("Return has no errors\n");
- return ;
- }
- var err = obj.get_object_member(type);
-
- if (_this.file == null) {
- return; // just in case the file has not loaded yet?
- }
-
-
- print("checking for errors in " + _this.file.path);
-
- if (!err.has_member(_this.file.path)) {
- print("File path has no errors\n");
- return ;
- }
- var lines = err.get_object_member(_this.file.path);
-
-
-
- var tlines = buf.get_line_count () +1;
-
- lines.foreach_member((obj, line, node) => {
-
- Gtk.TextIter iter;
- // print("get inter\n");
- var eline = int.parse(line) -1 ;
- print("GOT ERROR on line %s -- converted to %d\n", line,eline);
-
-
- if (eline > tlines || eline < 0) {
- return;
- }
- sbuf.get_iter_at_line( out iter, eline);
- //print("mark line\n");
- var msg = type + " on line: %d ".printf(eline+1 );
- var ar = lines.get_array_member(line);
- for (var i = 0 ; i < ar.get_length(); i++) {
- msg += (msg.length > 0) ? "\n" : "";
- msg += ar.get_string_element(i);
- }
-
-
- sbuf.create_source_mark(msg, type, iter);
- } );
+ // this is a hook for the vala code - it has no value in javascript
+ // as we only have one error ususally....
return ;
}
-
+
return p.javascriptHasErrors(
_this.main_window.windowstate,
str,
"", // _this.key,
"file", //_this.ptype,
_this.file,
- null,
null
);