Merge pull request #40800 from briansemrau/fix-shader-comment-highlighting

Fixed Shader editor single-line comment highlight
This commit is contained in:
Rémi Verschelde 2020-07-28 21:44:30 +02:00 committed by GitHub
commit 7a31baf3b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -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() {

View File

@ -887,7 +887,7 @@ void VisualShaderEditor::_update_graph() {
expression_syntax_highlighter->set_symbol_color(symbol_color);
expression_syntax_highlighter->set_function_color(function_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);
@ -1756,7 +1756,7 @@ void VisualShaderEditor::_notification(int p_what) {
syntax_highlighter->set_function_color(function_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"));

View File

@ -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();
}