Merge pull request #2264 from zed-industries/make-terminal-default-better
Make terminal fallback correctly when unable to deserialize a cwd
This commit is contained in:
commit
74b10e4ba5
1 changed files with 13 additions and 2 deletions
|
@ -653,7 +653,7 @@ impl Item for TerminalView {
|
||||||
|
|
||||||
fn deserialize(
|
fn deserialize(
|
||||||
project: ModelHandle<Project>,
|
project: ModelHandle<Project>,
|
||||||
_workspace: WeakViewHandle<Workspace>,
|
workspace: WeakViewHandle<Workspace>,
|
||||||
workspace_id: workspace::WorkspaceId,
|
workspace_id: workspace::WorkspaceId,
|
||||||
item_id: workspace::ItemId,
|
item_id: workspace::ItemId,
|
||||||
cx: &mut ViewContext<Pane>,
|
cx: &mut ViewContext<Pane>,
|
||||||
|
@ -663,7 +663,18 @@ impl Item for TerminalView {
|
||||||
let cwd = TERMINAL_DB
|
let cwd = TERMINAL_DB
|
||||||
.get_working_directory(item_id, workspace_id)
|
.get_working_directory(item_id, workspace_id)
|
||||||
.log_err()
|
.log_err()
|
||||||
.flatten();
|
.flatten()
|
||||||
|
.or_else(|| {
|
||||||
|
cx.read(|cx| {
|
||||||
|
let strategy = cx.global::<Settings>().terminal_strategy();
|
||||||
|
workspace
|
||||||
|
.upgrade(cx)
|
||||||
|
.map(|workspace| {
|
||||||
|
get_working_directory(workspace.read(cx), cx, strategy)
|
||||||
|
})
|
||||||
|
.flatten()
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
cx.update(|cx| {
|
cx.update(|cx| {
|
||||||
let terminal = project.update(cx, |project, cx| {
|
let terminal = project.update(cx, |project, cx| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue