| 167 | } |
| 168 | |
| 169 | void TextEditor::reload_text() { |
| 170 | ERR_FAIL_COND(edited_res.is_null()); |
| 171 | |
| 172 | CodeEdit *te = code_editor->get_text_editor(); |
| 173 | int column = te->get_caret_column(); |
| 174 | int row = te->get_caret_line(); |
| 175 | int h = te->get_h_scroll(); |
| 176 | int v = te->get_v_scroll(); |
| 177 | |
| 178 | Ref<TextFile> text_file = edited_res; |
| 179 | if (text_file.is_valid()) { |
| 180 | te->set_text(text_file->get_text()); |
| 181 | } |
| 182 | |
| 183 | Ref<JSON> json_file = edited_res; |
| 184 | if (json_file.is_valid()) { |
| 185 | te->set_text(json_file->get_parsed_text()); |
| 186 | } |
| 187 | |
| 188 | te->set_caret_line(row); |
| 189 | te->set_caret_column(column); |
| 190 | te->set_h_scroll(h); |
| 191 | te->set_v_scroll(v); |
| 192 | |
| 193 | te->tag_saved_version(); |
| 194 | |
| 195 | code_editor->update_line_and_column(); |
| 196 | _validate_script(); |
| 197 | } |
| 198 | |
| 199 | void TextEditor::_validate_script() { |
| 200 | emit_signal(SNAME("name_changed")); |
no test coverage detected