diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 22 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 1 | ||||
-rw-r--r-- | editor/plugins/text_editor.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/text_editor.h | 1 |
5 files changed, 32 insertions, 10 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index d999f3189e..9cf889c5b0 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2088,16 +2088,18 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra } ERR_FAIL_COND_V(!se, false); - bool highlighter_set = false; - for (int i = 0; i < syntax_highlighters_func_count; i++) { - SyntaxHighlighter *highlighter = syntax_highlighters_funcs[i](); - se->add_syntax_highlighter(highlighter); - - if (script != NULL && !highlighter_set) { - List<String> languages = highlighter->get_supported_languages(); - if (languages.find(script->get_language()->get_name())) { - se->set_syntax_highlighter(highlighter); - highlighter_set = true; + if (p_resource->get_class_name() != StringName("VisualScript")) { + bool highlighter_set = false; + for (int i = 0; i < syntax_highlighters_func_count; i++) { + SyntaxHighlighter *highlighter = syntax_highlighters_funcs[i](); + se->add_syntax_highlighter(highlighter); + + if (script != NULL && !highlighter_set) { + List<String> languages = highlighter->get_supported_languages(); + if (languages.find(script->get_language()->get_name())) { + se->set_syntax_highlighter(highlighter); + highlighter_set = true; + } } } } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 438621115b..07303da2ff 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1819,6 +1819,15 @@ ScriptTextEditor::ScriptTextEditor() { code_editor->get_text_edit()->set_drag_forwarding(this); } +ScriptTextEditor::~ScriptTextEditor() { + for (const Map<String, SyntaxHighlighter *>::Element *E = highlighters.front(); E; E = E->next()) { + if (E->get() != NULL) { + memdelete(E->get()); + } + } + highlighters.clear(); +} + static ScriptEditorBase *create_editor(const RES &p_resource) { if (Object::cast_to<Script>(*p_resource)) { diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 9a2a514a6e..4dbade472c 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -231,6 +231,7 @@ public: virtual void validate(); ScriptTextEditor(); + ~ScriptTextEditor(); }; #endif // SCRIPT_TEXT_EDITOR_H diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index fae88f4eb7..34d8e6aff5 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -695,5 +695,14 @@ TextEditor::TextEditor() { code_editor->get_text_edit()->set_drag_forwarding(this); } +TextEditor::~TextEditor() { + for (const Map<String, SyntaxHighlighter *>::Element *E = highlighters.front(); E; E = E->next()) { + if (E->get() != NULL) { + memdelete(E->get()); + } + } + highlighters.clear(); +} + void TextEditor::validate() { } diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index ae0c0bcf93..3a330576ae 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -154,6 +154,7 @@ public: static void register_editor(); TextEditor(); + ~TextEditor(); }; #endif // TEXT_EDITOR_H |