project_panel: Fix clicking away to create file or directory doesn't create it (#39716)

Closes #38919

Now, when unfocusing the filename editor while creating a file or
directory in the project panel, it will create it by default unless the
name is empty or already exists.

Release Notes:

- Improved behavior where unfocusing while creating a new file or
directory in the project panel now creates it instead of discarding it.
This commit is contained in:
Smit Barmase
2025-10-08 02:23:44 +05:30
committed by GitHub
parent 791ba9ce4c
commit 41f1835bbe
+11 -3
View File
@@ -643,9 +643,17 @@ impl ProjectPanel {
.as_ref()
.is_some_and(|state| state.processing_filename.is_none())
{
project_panel.state.edit_state = None;
project_panel.update_visible_entries(None, false, false, window, cx);
cx.notify();
match project_panel.confirm_edit(window, cx) {
Some(task) => {
task.detach_and_notify_err(window, cx);
}
None => {
project_panel.state.edit_state = None;
project_panel
.update_visible_entries(None, false, false, window, cx);
cx.notify();
}
}
}
}
_ => {}