1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Merge pull request #103825 from JulianHeuser/region_highlight_crash_fix

Fix crash related to #region/#endregion caused by trailing spaces
This commit is contained in:
Thaddeus Crews
2025-03-11 19:54:46 -05:00
5 changed files with 24 additions and 8 deletions

View File

@@ -151,10 +151,13 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
}
}
// "#region" and "#endregion" only highlighted if they're the first region on the line.
if (color_regions[c].type == ColorRegion::TYPE_CODE_REGION &&
str.strip_edges().split_spaces()[0] != "#region" &&
str.strip_edges().split_spaces()[0] != "#endregion") {
match = false;
if (color_regions[c].type == ColorRegion::TYPE_CODE_REGION) {
Vector<String> str_stripped_split = str.strip_edges().split_spaces(1);
if (!str_stripped_split.is_empty() &&
str_stripped_split[0] != "#region" &&
str_stripped_split[0] != "#endregion") {
match = false;
}
}
if (!match) {
continue;