summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Semrau <brian.semrau@gmail.com>2020-07-28 15:16:24 -0400
committerBrian Semrau <brian.semrau@gmail.com>2020-07-28 15:16:24 -0400
commit69d1c48b73122f34187d952a08f2a7eb82fd2403 (patch)
tree69f2ecc02f440967c46f314548dd9b501cc244f7
parent91b21e5fbc7ad00cf251d89129c84f921935e5f4 (diff)
Fixed shader editor comment highlighting
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp4
-rw-r--r--scene/resources/syntax_highlighter.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index dc2abe15ee..2a7f3f0656 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -172,7 +172,7 @@ void ShaderTextEditor::_load_theme_settings() {
const Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
syntax_highlighter->clear_color_regions();
syntax_highlighter->add_color_region("/*", "*/", comment_color, false);
- syntax_highlighter->add_color_region("//", "", comment_color, false);
+ syntax_highlighter->add_color_region("//", "", comment_color, true);
}
void ShaderTextEditor::_check_shader_mode() {
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 5473b0c284..539b36e0d8 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -885,7 +885,7 @@ void VisualShaderEditor::_update_graph() {
expression_box->add_theme_color_override("font_color", text_color);
expression_syntax_highlighter->set_symbol_color(symbol_color);
expression_syntax_highlighter->add_color_region("/*", "*/", comment_color, false);
- expression_syntax_highlighter->add_color_region("//", "", comment_color, false);
+ expression_syntax_highlighter->add_color_region("//", "", comment_color, true);
expression_box->set_text(expression);
expression_box->set_context_menu_enabled(false);
@@ -1752,7 +1752,7 @@ void VisualShaderEditor::_notification(int p_what) {
syntax_highlighter->set_symbol_color(symbol_color);
syntax_highlighter->clear_color_regions();
syntax_highlighter->add_color_region("/*", "*/", comment_color, false);
- syntax_highlighter->add_color_region("//", "", comment_color, false);
+ syntax_highlighter->add_color_region("//", "", comment_color, true);
error_text->add_theme_font_override("font", get_theme_font("status_source", "EditorFonts"));
error_text->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
diff --git a/scene/resources/syntax_highlighter.cpp b/scene/resources/syntax_highlighter.cpp
index abf7235fd6..9c8f9334a9 100644
--- a/scene/resources/syntax_highlighter.cpp
+++ b/scene/resources/syntax_highlighter.cpp
@@ -488,7 +488,7 @@ void CodeHighlighter::add_color_region(const String &p_start_key, const String &
color_region.color = p_color;
color_region.start_key = p_start_key;
color_region.end_key = p_end_key;
- color_region.line_only = p_line_only;
+ color_region.line_only = p_line_only || p_end_key == "";
color_regions.push_back(color_region);
clear_highlighting_cache();
}