diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2020-10-03 14:56:13 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2020-10-03 14:58:55 +0100 |
commit | ee4a1c99a78a4fc2d39e953b358a764ef8eae0e4 (patch) | |
tree | eb5146e960cf047a2fa5ceaea108c35207d94331 /modules/gdscript/editor | |
parent | 9b1c9cef17ef06e5ae80309189464ca6afe7e551 (diff) |
Switch from recursion to iterative for backfilling colour regions
Diffstat (limited to 'modules/gdscript/editor')
-rw-r--r-- | modules/gdscript/editor/gdscript_highlighter.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index 9a3273d201..7f7410a92c 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -73,6 +73,13 @@ 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); } |