summaryrefslogtreecommitdiffstats
path: root/scene/gui/file_dialog.cpp
diff options
context:
space:
mode:
authorvolzhs <volzhs@gmail.com>2016-11-15 22:36:41 +0900
committervolzhs <volzhs@gmail.com>2016-11-17 03:39:30 +0900
commitff4f04e87844290f3bef5f2ee874c11a7b546a37 (patch)
tree989e6865be86432e11f1dd564b27e760047e6b5f /scene/gui/file_dialog.cpp
parentea87f0f9d905b0766e489d9f31ce2746d581949a (diff)
downloadredot-engine-ff4f04e87844290f3bef5f2ee874c11a7b546a37.tar.gz
Select exactly matched file automatically in FileDialog
Diffstat (limited to 'scene/gui/file_dialog.cpp')
-rw-r--r--scene/gui/file_dialog.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index f942f15ed0..b0214b8648 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -403,11 +403,12 @@ void FileDialog::update_file_list() {
while(!files.empty()) {
bool match=patterns.empty();
+ String match_str;
for(List<String>::Element *E=patterns.front();E;E=E->next()) {
if (files.front()->get().matchn(E->get())) {
-
+ match_str=E->get();
match=true;
break;
}
@@ -432,14 +433,14 @@ void FileDialog::update_file_list() {
d["dir"]=false;
ti->set_metadata(0,d);
- if (file->get_text()==files.front()->get())
+ if (file->get_text()==files.front()->get() || match_str==files.front()->get())
ti->select(0);
}
files.pop_front();
}
- if (tree->get_root() && tree->get_root()->get_children())
+ if (tree->get_root() && tree->get_root()->get_children() && tree->get_selected()==NULL)
tree->get_root()->get_children()->select(0);
files.clear();