Adjust "recent projects" modal behavior to allow opening projects in both current and new window (#8267)
 Fixes https://github.com/zed-industries/zed/issues/7419 by changing the way "recent projects" modal confirm actions work: * `menu::Confirm` now reuses the current window when opening a recent project * `menu::SecondaryConfirm` now opens a recent project in the new window * neither confirm tries to open the current project anymore * modal's placeholder is adjusted to emphasize this behavior Release Notes: - Added a way to open recent projects in the new window
This commit is contained in:
parent
a588f674db
commit
71557f3eb3
5 changed files with 30 additions and 10 deletions
|
@ -1387,7 +1387,9 @@ impl Workspace {
|
|||
};
|
||||
|
||||
if let Some(task) = this
|
||||
.update(&mut cx, |this, cx| this.open_workspace_for_paths(paths, cx))
|
||||
.update(&mut cx, |this, cx| {
|
||||
this.open_workspace_for_paths(false, paths, cx)
|
||||
})
|
||||
.log_err()
|
||||
{
|
||||
task.await.log_err();
|
||||
|
@ -1398,6 +1400,7 @@ impl Workspace {
|
|||
|
||||
pub fn open_workspace_for_paths(
|
||||
&mut self,
|
||||
replace_current_window: bool,
|
||||
paths: Vec<PathBuf>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Task<Result<()>> {
|
||||
|
@ -1405,7 +1408,10 @@ impl Workspace {
|
|||
let is_remote = self.project.read(cx).is_remote();
|
||||
let has_worktree = self.project.read(cx).worktrees().next().is_some();
|
||||
let has_dirty_items = self.items(cx).any(|item| item.is_dirty(cx));
|
||||
let window_to_replace = if is_remote || has_worktree || has_dirty_items {
|
||||
|
||||
let window_to_replace = if replace_current_window {
|
||||
window
|
||||
} else if is_remote || has_worktree || has_dirty_items {
|
||||
None
|
||||
} else {
|
||||
window
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue