Merge pull request #7124 from volzhs/select_match
Select exactly matched file automatically in FileDialog
This commit is contained in:
commit
e3c09ed90d
|
@ -403,11 +403,12 @@ void FileDialog::update_file_list() {
|
||||||
while(!files.empty()) {
|
while(!files.empty()) {
|
||||||
|
|
||||||
bool match=patterns.empty();
|
bool match=patterns.empty();
|
||||||
|
String match_str;
|
||||||
|
|
||||||
for(List<String>::Element *E=patterns.front();E;E=E->next()) {
|
for(List<String>::Element *E=patterns.front();E;E=E->next()) {
|
||||||
|
|
||||||
if (files.front()->get().matchn(E->get())) {
|
if (files.front()->get().matchn(E->get())) {
|
||||||
|
match_str=E->get();
|
||||||
match=true;
|
match=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -432,14 +433,14 @@ void FileDialog::update_file_list() {
|
||||||
d["dir"]=false;
|
d["dir"]=false;
|
||||||
ti->set_metadata(0,d);
|
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);
|
ti->select(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
files.pop_front();
|
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);
|
tree->get_root()->get_children()->select(0);
|
||||||
|
|
||||||
files.clear();
|
files.clear();
|
||||||
|
|
Loading…
Reference in New Issue