MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / reload_text

Method reload_text

editor/script/text_editor.cpp:169–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void 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
199void TextEditor::_validate_script() {
200 emit_signal(SNAME("name_changed"));

Callers 1

_reload_scriptsMethod · 0.45

Calls 15

get_text_editorMethod · 0.80
get_caret_lineMethod · 0.80
set_caret_lineMethod · 0.80
is_nullMethod · 0.45
get_caret_columnMethod · 0.45
get_h_scrollMethod · 0.45
get_v_scrollMethod · 0.45
is_validMethod · 0.45
set_textMethod · 0.45
get_textMethod · 0.45
get_parsed_textMethod · 0.45

Tested by

no test coverage detected