summaryrefslogtreecommitdiffstats
path: root/editor/find_in_files.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/find_in_files.cpp')
-rw-r--r--editor/find_in_files.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index a14df01858..c6087f5b13 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -34,8 +34,8 @@
#include "core/io/dir_access.h"
#include "core/os/os.h"
#include "editor/editor_node.h"
-#include "editor/editor_scale.h"
#include "editor/editor_string_names.h"
+#include "editor/themes/editor_scale.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/check_box.h"
@@ -172,9 +172,11 @@ void FindInFiles::_iterate() {
_current_dir = _current_dir.path_join(folder_name);
PackedStringArray sub_dirs;
- _scan_dir("res://" + _current_dir, sub_dirs);
+ PackedStringArray files_to_scan;
+ _scan_dir("res://" + _current_dir, sub_dirs, files_to_scan);
_folders_stack.push_back(sub_dirs);
+ _files_to_scan.append_array(files_to_scan);
} else {
// Go back one level.
@@ -211,7 +213,7 @@ float FindInFiles::get_progress() const {
return 0;
}
-void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders) {
+void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders, PackedStringArray &out_files_to_scan) {
Ref<DirAccess> dir = DirAccess::open(path);
if (dir.is_null()) {
print_verbose("Cannot open directory! " + path);
@@ -227,8 +229,11 @@ void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders) {
break;
}
- // If there is a .gdignore file in the directory, skip searching the directory.
+ // If there is a .gdignore file in the directory, clear all the files/folders
+ // to be searched on this path and skip searching the directory.
if (file == ".gdignore") {
+ out_folders.clear();
+ out_files_to_scan.clear();
break;
}
@@ -247,7 +252,7 @@ void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders) {
} else {
String file_ext = file.get_extension();
if (_extension_filter.has(file_ext)) {
- _files_to_scan.push_back(path.path_join(file));
+ out_files_to_scan.push_back(path.path_join(file));
}
}
}
@@ -460,7 +465,7 @@ void FindInFilesDialog::_notification(int p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: {
if (is_visible()) {
// Doesn't work more than once if not deferred...
- _search_text_line_edit->call_deferred(SNAME("grab_focus"));
+ callable_mp((Control *)_search_text_line_edit, &Control::grab_focus).call_deferred();
_search_text_line_edit->select_all();
// Extensions might have changed in the meantime, we clean them and instance them again.
for (int i = 0; i < _filters_container->get_child_count(); i++) {
@@ -742,7 +747,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin
String start = vformat("%3s: ", line_number);
item->set_text(text_index, start + text);
- item->set_custom_draw(text_index, this, "_draw_result_text");
+ item->set_custom_draw_callback(text_index, callable_mp(this, &FindInFilesPanel::draw_result_text));
Result r;
r.line_number = line_number;
@@ -983,7 +988,6 @@ void FindInFilesPanel::set_progress_visible(bool p_visible) {
void FindInFilesPanel::_bind_methods() {
ClassDB::bind_method("_on_result_found", &FindInFilesPanel::_on_result_found);
ClassDB::bind_method("_on_finished", &FindInFilesPanel::_on_finished);
- ClassDB::bind_method("_draw_result_text", &FindInFilesPanel::draw_result_text);
ADD_SIGNAL(MethodInfo(SIGNAL_RESULT_SELECTED,
PropertyInfo(Variant::STRING, "path"),