mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 15:21:56 -05:00
Fix region section not ignoring #region and #endregion when in a string
When using the script editor, if the keywords #region and #endregion where in a string and ate the start of the line, the editor would not ignore them and count them as the actual keywords, which when folded, would only fold until the first #endregion in a string, for example. By checking if these keywords were in a string, this commit now ensures the editor ignores strings and fold the section correctly. Fixes #89115.
This commit is contained in:
@@ -1861,6 +1861,9 @@ bool CodeEdit::is_line_code_region_start(int p_line) const {
|
||||
if (code_region_start_string.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
if (is_in_string(p_line) != -1) {
|
||||
return false;
|
||||
}
|
||||
return get_line(p_line).strip_edges().begins_with(code_region_start_string);
|
||||
}
|
||||
|
||||
@@ -1869,6 +1872,9 @@ bool CodeEdit::is_line_code_region_end(int p_line) const {
|
||||
if (code_region_start_string.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
if (is_in_string(p_line) != -1) {
|
||||
return false;
|
||||
}
|
||||
return get_line(p_line).strip_edges().begins_with(code_region_end_string);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user