You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Fix editor infinit loop in search_prev
Fixes godotengine#31328
This commit is contained in:
@@ -366,7 +366,6 @@ bool FindReplaceBar::search_prev() {
|
|||||||
if (text_edit->is_selection_active())
|
if (text_edit->is_selection_active())
|
||||||
col--; // Skip currently selected word.
|
col--; // Skip currently selected word.
|
||||||
|
|
||||||
if (line == result_line && col == result_col) {
|
|
||||||
col -= text.length();
|
col -= text.length();
|
||||||
if (col < 0) {
|
if (col < 0) {
|
||||||
line -= 1;
|
line -= 1;
|
||||||
@@ -374,7 +373,6 @@ bool FindReplaceBar::search_prev() {
|
|||||||
line = text_edit->get_line_count() - 1;
|
line = text_edit->get_line_count() - 1;
|
||||||
col = text_edit->get_line(line).length();
|
col = text_edit->get_line(line).length();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return _search(flags, line, col);
|
return _search(flags, line, col);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5365,6 +5365,9 @@ bool TextEdit::search(const String &p_key, uint32_t p_search_flags, int p_from_l
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pos_from = last_pos - p_key.length();
|
pos_from = last_pos - p_key.length();
|
||||||
|
if (pos_from < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.find(p_key, pos_from) : text_line.findn(p_key, pos_from)) != -1) {
|
while ((last_pos = (p_search_flags & SEARCH_MATCH_CASE) ? text_line.find(p_key, pos_from) : text_line.findn(p_key, pos_from)) != -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user