From 891b17d5dba314535f71a79f7c825d146608cedf Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Sat, 11 Mar 2023 16:18:29 +0000 Subject: [PATCH] Fix TextEdit color_region_cache bug Due to a single error, _is_line_in_region was previously iterating over the color highlighting for the entire document repeatedly for each line in the script. This is now fixed, which should make the editor much faster with large scripts. (cherry picked from commit 57306bf0e3c05a889a01f58fed6a8d4425630439) --- scene/gui/text_edit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 08c05687845..ef9ef67b5cf 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -5475,7 +5475,7 @@ int TextEdit::_is_line_in_region(int p_line) { // If not find the closest line we have. int previous_line = p_line - 1; for (; previous_line > -1; previous_line--) { - if (color_region_cache.has(p_line)) { + if (color_region_cache.has(previous_line)) { break; } }