Merge pull request #38298 from ThakeeNathees/file-dialog-autocomplete-fix

This commit is contained in:
Rémi Verschelde 2022-07-04 10:10:47 +02:00 committed by GitHub
commit ba8e7efc2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -731,9 +731,9 @@ void EditorFileDialog::update_file_name() {
String base_name = file_str.get_basename(); String base_name = file_str.get_basename();
Vector<String> filter_substr = filter_str.split(";"); Vector<String> filter_substr = filter_str.split(";");
if (filter_substr.size() >= 2) { if (filter_substr.size() >= 2) {
file_str = base_name + "." + filter_substr[0].strip_edges().lstrip("*.").to_lower(); file_str = base_name + "." + filter_substr[0].strip_edges().get_extension().to_lower();
} else { } else {
file_str = base_name + "." + filter_str.get_extension().strip_edges().to_lower(); file_str = base_name + "." + filter_str.strip_edges().get_extension().to_lower();
} }
file->set_text(file_str); file->set_text(file_str);
} }

View File

@ -480,7 +480,12 @@ void FileDialog::update_file_name() {
String filter_str = filters[idx]; String filter_str = filters[idx];
String file_str = file->get_text(); String file_str = file->get_text();
String base_name = file_str.get_basename(); String base_name = file_str.get_basename();
file_str = base_name + "." + filter_str.strip_edges().to_lower(); Vector<String> filter_substr = filter_str.split(";");
if (filter_substr.size() >= 2) {
file_str = base_name + "." + filter_substr[0].strip_edges().get_extension().to_lower();
} else {
file_str = base_name + "." + filter_str.strip_edges().get_extension().to_lower();
}
file->set_text(file_str); file->set_text(file_str);
} }
} }