Merge pull request #119968 from Chaosus/shader_update_syntax_highlighting

Properly update shader text syntax highlighting (for disabled regions)
This commit is contained in:
Thaddeus Crews
2026-06-02 09:39:08 -05:00
3 changed files with 13 additions and 2 deletions
+1
View File
@@ -1273,6 +1273,7 @@ void ShaderTextEditor::_validate_script() {
syntax_highlighter->add_disabled_branch_region(Point2i(region.from_line, region.to_line));
}
}
syntax_highlighter->emit_changed();
set_error("");
set_error_count(0);
+11 -2
View File
@@ -7029,12 +7029,16 @@ void TextEdit::set_syntax_highlighter(Ref<SyntaxHighlighter> p_syntax_highlighte
return;
}
if (syntax_highlighter.is_valid()) {
syntax_highlighter->disconnect_changed(callable_mp(this, &TextEdit::_syntax_highlighter_changed));
}
syntax_highlighter = p_syntax_highlighter;
if (syntax_highlighter.is_valid()) {
syntax_highlighter->set_text_edit(this);
syntax_highlighter->connect_changed(callable_mp(this, &TextEdit::_syntax_highlighter_changed));
}
_clear_syntax_highlighting_cache();
queue_redraw();
_syntax_highlighter_changed();
}
Ref<SyntaxHighlighter> TextEdit::get_syntax_highlighter() const {
@@ -9109,6 +9113,11 @@ void TextEdit::_clear_syntax_highlighting_cache() {
syntax_highlighting_cache.clear();
}
void TextEdit::_syntax_highlighter_changed() {
_clear_syntax_highlighting_cache();
queue_redraw();
}
/* Deprecated. */
#ifndef DISABLE_DEPRECATED
Vector<int> TextEdit::get_caret_index_edit_order() {
+1
View File
@@ -603,6 +603,7 @@ private:
Vector<Pair<int64_t, Color>> _get_line_syntax_highlighting(int p_line);
void _clear_syntax_highlighting_cache();
void _syntax_highlighter_changed();
/* Visual. */
struct ThemeCache {