Skip to content

Commit

Permalink
Fix TextEdit color_region_cache bug
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lawnjelly committed Mar 11, 2023
1 parent 8e7bb46 commit 57306bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5488,7 +5488,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;
}
}
Expand Down

0 comments on commit 57306bf

Please sign in to comment.