You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Merge pull request #110946 from KoBeWi/regions_of_ruin
Fix region folding not loading properly
This commit is contained in:
@@ -184,6 +184,11 @@ void ScriptTextEditor::enable_editor(Control *p_shortcut_context) {
|
|||||||
|
|
||||||
_validate_script();
|
_validate_script();
|
||||||
|
|
||||||
|
if (pending_state != Variant()) {
|
||||||
|
code_editor->set_edit_state(pending_state);
|
||||||
|
pending_state = Variant();
|
||||||
|
}
|
||||||
|
|
||||||
if (p_shortcut_context) {
|
if (p_shortcut_context) {
|
||||||
for (int i = 0; i < edit_hb->get_child_count(); ++i) {
|
for (int i = 0; i < edit_hb->get_child_count(); ++i) {
|
||||||
Control *c = cast_to<Control>(edit_hb->get_child(i));
|
Control *c = cast_to<Control>(edit_hb->get_child(i));
|
||||||
@@ -704,11 +709,19 @@ bool ScriptTextEditor::is_unsaved() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Variant ScriptTextEditor::get_edit_state() {
|
Variant ScriptTextEditor::get_edit_state() {
|
||||||
|
if (pending_state != Variant()) {
|
||||||
|
return pending_state;
|
||||||
|
}
|
||||||
return code_editor->get_edit_state();
|
return code_editor->get_edit_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptTextEditor::set_edit_state(const Variant &p_state) {
|
void ScriptTextEditor::set_edit_state(const Variant &p_state) {
|
||||||
|
if (editor_enabled) {
|
||||||
code_editor->set_edit_state(p_state);
|
code_editor->set_edit_state(p_state);
|
||||||
|
} else {
|
||||||
|
// The editor is not fully initialized, so the state can't be loaded properly.
|
||||||
|
pending_state = p_state;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary state = p_state;
|
Dictionary state = p_state;
|
||||||
if (state.has("syntax_highlighter")) {
|
if (state.has("syntax_highlighter")) {
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class ScriptTextEditor : public ScriptEditorBase {
|
|||||||
RichTextLabel *errors_panel = nullptr;
|
RichTextLabel *errors_panel = nullptr;
|
||||||
|
|
||||||
Ref<Script> script;
|
Ref<Script> script;
|
||||||
|
Variant pending_state;
|
||||||
bool script_is_valid = false;
|
bool script_is_valid = false;
|
||||||
bool editor_enabled = false;
|
bool editor_enabled = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user