diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index 110815e870..330be6dcf4 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -653,7 +653,7 @@ impl Item for TerminalView { fn deserialize( project: ModelHandle, - _workspace: WeakViewHandle, + workspace: WeakViewHandle, workspace_id: workspace::WorkspaceId, item_id: workspace::ItemId, cx: &mut ViewContext, @@ -663,7 +663,18 @@ impl Item for TerminalView { let cwd = TERMINAL_DB .get_working_directory(item_id, workspace_id) .log_err() - .flatten(); + .flatten() + .or_else(|| { + cx.read(|cx| { + let strategy = cx.global::().terminal_strategy(); + workspace + .upgrade(cx) + .map(|workspace| { + get_working_directory(workspace.read(cx), cx, strategy) + }) + .flatten() + }) + }); cx.update(|cx| { let terminal = project.update(cx, |project, cx| {