diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-21 13:01:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-21 13:01:43 +0200 |
commit | 71bbe6eb01d1664340ea624aca36aa47c693981d (patch) | |
tree | 7fab2ac8f65a8d3190d4255d1ba22cbb52a8697f /editor/plugins/script_text_editor.cpp | |
parent | 7879968136828a6b98daab9ee4e8897eb8c26048 (diff) | |
parent | 6ea253aa776e03dc7174b289c6747cd8d0410245 (diff) | |
download | redot-engine-71bbe6eb01d1664340ea624aca36aa47c693981d.tar.gz |
Merge pull request #27979 from Paulb23/remember_script_state
Restore script editor state between sessions
Diffstat (limited to 'editor/plugins/script_text_editor.cpp')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index c586985957..4e5034b6b7 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -320,7 +320,6 @@ void ScriptTextEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: _load_theme_settings(); - _change_syntax_highlighter(EditorSettings::get_singleton()->get_project_metadata("script_text_editor", "syntax_highlighter", 0)); break; } } @@ -365,6 +364,14 @@ Variant ScriptTextEditor::get_edit_state() { void ScriptTextEditor::set_edit_state(const Variant &p_state) { code_editor->set_edit_state(p_state); + + Dictionary state = p_state; + if (state.has("syntax_highlighter")) { + int idx = highlighter_menu->get_item_idx_from_text(state["syntax_highlighter"]); + if (idx >= 0) { + _change_syntax_highlighter(idx); + } + } } void ScriptTextEditor::_convert_case(CodeTextEditor::CaseStyle p_case) { @@ -1026,7 +1033,6 @@ void ScriptTextEditor::_change_syntax_highlighter(int p_idx) { } // highlighter_menu->set_item_checked(p_idx, true); set_syntax_highlighter(highlighters[highlighter_menu->get_item_text(p_idx)]); - EditorSettings::get_singleton()->set_project_metadata("script_text_editor", "syntax_highlighter", p_idx); } void ScriptTextEditor::_bind_methods() { |