Properly select the newly duplicated file

(cherry picked from commit 0ae1241304)
This commit is contained in:
kobewi 2023-12-14 18:18:44 +01:00 committed by Yuri Sizov
parent 88526a23a5
commit 1f677eb279
2 changed files with 9 additions and 2 deletions

View File

@ -1297,6 +1297,13 @@ void FileSystemDock::_fs_changed() {
_update_file_list(true); _update_file_list(true);
} }
if (!select_after_scan.is_empty()) {
_navigate_to_path(select_after_scan);
select_after_scan.clear();
import_dock_needs_update = true;
_update_import_dock();
}
set_process(false); set_process(false);
} }
@ -1476,8 +1483,6 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin
EditorNode::get_singleton()->add_io_error(TTR("Cannot move a folder into itself.") + "\n" + old_path + "\n"); EditorNode::get_singleton()->add_io_error(TTR("Cannot move a folder into itself.") + "\n" + old_path + "\n");
return; return;
} }
const_cast<FileSystemDock *>(this)->current_path = new_path;
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES); Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
if (p_item.is_file) { if (p_item.is_file) {
@ -1917,6 +1922,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_cop
for (int i = 0; i < to_move.size(); i++) { for (int i = 0; i < to_move.size(); i++) {
if (to_move[i].path != new_paths[i]) { if (to_move[i].path != new_paths[i]) {
_try_duplicate_item(to_move[i], new_paths[i]); _try_duplicate_item(to_move[i], new_paths[i]);
select_after_scan = new_paths[i];
is_copied = true; is_copied = true;
} }
} }

View File

@ -225,6 +225,7 @@ private:
int history_max_size; int history_max_size;
String current_path; String current_path;
String select_after_scan;
bool initialized = false; bool initialized = false;