MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _search

Method _search

editor/gui/code_editor.cpp:212–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) {
213 if (!preserve_cursor) {
214 text_editor->remove_secondary_carets();
215 }
216 String text = get_search_text();
217 Point2i pos = text_editor->search(text, p_flags, p_from_line, p_from_col);
218
219 if (pos.x != -1) {
220 if (!preserve_cursor && !is_selection_only()) {
221 text_editor->unfold_line(pos.y);
222 text_editor->select(pos.y, pos.x, pos.y, pos.x + text.length());
223 text_editor->center_viewport_to_caret(0);
224 text_editor->set_code_hint("");
225 text_editor->cancel_code_completion();
226
227 line_col_changed_for_result = true;
228 }
229
230 text_editor->set_search_text(text);
231 text_editor->set_search_flags(p_flags);
232
233 result_line = pos.y;
234 result_col = pos.x;
235
236 _update_results_count();
237 } else {
238 results_count = 0;
239 result_line = -1;
240 result_col = -1;
241 text_editor->set_search_text("");
242 text_editor->set_search_flags(p_flags);
243 }
244
245 _update_matches_display();
246
247 return pos.x != -1;
248}
249
250void FindReplaceBar::_replace() {
251 text_editor->begin_complex_operation();

Callers

nothing calls this directly

Calls 10

unfold_lineMethod · 0.80
set_code_hintMethod · 0.80
set_search_flagsMethod · 0.80
searchMethod · 0.45
selectMethod · 0.45
lengthMethod · 0.45
set_search_textMethod · 0.45

Tested by

no test coverage detected