Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve consistency in file order #37796

Merged
merged 1 commit into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ bool EditorFileSystem::_update_scan_actions() {
case ItemAction::ACTION_DIR_ADD: {
int idx = 0;
for (int i = 0; i < ia.dir->subdirs.size(); i++) {
if (ia.new_dir->name < ia.dir->subdirs[i]->name) {
if (ia.new_dir->name.naturalnocasecmp_to(ia.dir->subdirs[i]->name) < 0) {
break;
}
idx++;
Expand All @@ -528,7 +528,7 @@ bool EditorFileSystem::_update_scan_actions() {
case ItemAction::ACTION_FILE_ADD: {
int idx = 0;
for (int i = 0; i < ia.dir->files.size(); i++) {
if (ia.new_file->file < ia.dir->files[i]->file) {
if (ia.new_file->file.naturalnocasecmp_to(ia.dir->files[i]->file) < 0) {
break;
}
idx++;
Expand Down Expand Up @@ -713,7 +713,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess

int idx2 = 0;
for (int i = 0; i < p_dir->subdirs.size(); i++) {
if (efd->name < p_dir->subdirs[i]->name) {
if (efd->name.naturalnocasecmp_to(p_dir->subdirs[i]->name) < 0) {
break;
}
idx2++;
Expand Down Expand Up @@ -1245,7 +1245,7 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector

int idx2 = 0;
for (int j = 0; j < fs->get_subdir_count(); j++) {
if (efsd->name < fs->get_subdir(j)->get_name()) {
if (efsd->name.naturalnocasecmp_to(fs->get_subdir(j)->get_name()) < 0) {
break;
}
idx2++;
Expand Down Expand Up @@ -1481,7 +1481,7 @@ void EditorFileSystem::update_file(const String &p_file) {
String file_name = p_file.get_file();

for (int i = 0; i < fs->files.size(); i++) {
if (file_name < fs->files[i]->file) {
if (p_file.naturalnocasecmp_to(fs->files[i]->file) < 0) {
break;
}
idx++;
Expand Down
1 change: 0 additions & 1 deletion editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,6 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
file_list.push_back(fi);
}
}
file_list.sort();
}

// Sort the file list if needed.
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ struct _ScriptEditorItemData {
if (sort_key == id.sort_key) {
return index < id.index;
} else {
return sort_key < id.sort_key;
return sort_key.naturalnocasecmp_to(id.sort_key) < 0;
}
} else {
return category < id.category;
Expand Down