| 321 | } |
| 322 | |
| 323 | void ScriptTextEditor::_error_clicked(const Variant &p_line) { |
| 324 | if (p_line.get_type() == Variant::INT) { |
| 325 | goto_line_centered(p_line.operator int64_t()); |
| 326 | } else if (p_line.get_type() == Variant::DICTIONARY) { |
| 327 | Dictionary meta = p_line.operator Dictionary(); |
| 328 | const String path = meta["path"].operator String(); |
| 329 | const int line = meta["line"].operator int64_t(); |
| 330 | const int column = meta["column"].operator int64_t(); |
| 331 | if (path.is_empty()) { |
| 332 | goto_line_centered(line, column); |
| 333 | } else { |
| 334 | Ref<Resource> scr = ResourceLoader::load(path); |
| 335 | if (scr.is_null()) { |
| 336 | EditorNode::get_singleton()->show_warning(TTR("Could not load file at:") + "\n\n" + path, TTR("Error!")); |
| 337 | } else { |
| 338 | int corrected_column = column; |
| 339 | |
| 340 | const String line_text = code_editor->get_text_editor()->get_line(line); |
| 341 | const int indent_size = code_editor->get_text_editor()->get_indent_size(); |
| 342 | if (indent_size > 1) { |
| 343 | const int tab_count = line_text.length() - line_text.lstrip("\t").length(); |
| 344 | corrected_column -= tab_count * (indent_size - 1); |
| 345 | } |
| 346 | |
| 347 | ScriptEditor::get_singleton()->edit(scr, line, corrected_column); |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | void ScriptTextEditor::reload_text() { |
| 354 | ERR_FAIL_COND(script.is_null()); |
nothing calls this directly
no test coverage detected