mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-24 04:46:48 +01:00
Ported: Switch from recursion to iterative for backfilling colour regions.
- Paulb23
ee4a1c99a7
This commit is contained in:
parent
a79792ee67
commit
e42c604bc3
@ -74,9 +74,19 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting(int p_line)
|
||||
color_region_cache[p_line] = -1;
|
||||
int in_region = -1;
|
||||
if (p_line != 0) {
|
||||
int prev_region_line = p_line - 1;
|
||||
while (prev_region_line > 0 && !color_region_cache.has(prev_region_line)) {
|
||||
prev_region_line--;
|
||||
}
|
||||
|
||||
for (int i = prev_region_line; i < p_line - 1; i++) {
|
||||
get_line_syntax_highlighting(i);
|
||||
}
|
||||
|
||||
if (!color_region_cache.has(p_line - 1)) {
|
||||
get_line_syntax_highlighting(p_line - 1);
|
||||
}
|
||||
|
||||
in_region = color_region_cache[p_line - 1];
|
||||
}
|
||||
|
||||
|
@ -160,9 +160,19 @@ Dictionary CodeHighlighter::_get_line_syntax_highlighting(int p_line) {
|
||||
color_region_cache[p_line] = -1;
|
||||
int in_region = -1;
|
||||
if (p_line != 0) {
|
||||
int prev_region_line = p_line - 1;
|
||||
while (prev_region_line > 0 && !color_region_cache.has(prev_region_line)) {
|
||||
prev_region_line--;
|
||||
}
|
||||
|
||||
for (int i = prev_region_line; i < p_line - 1; i++) {
|
||||
get_line_syntax_highlighting(i);
|
||||
}
|
||||
|
||||
if (!color_region_cache.has(p_line - 1)) {
|
||||
get_line_syntax_highlighting(p_line - 1);
|
||||
}
|
||||
|
||||
in_region = color_region_cache[p_line - 1];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user