Dock persistence working!
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
c1f7902309
commit
d20d21c6a2
29 changed files with 783 additions and 443 deletions
|
@ -34,7 +34,9 @@ use mappings::mouse::{
|
|||
|
||||
use procinfo::LocalProcessInfo;
|
||||
use settings::{AlternateScroll, Settings, Shell, TerminalBlink};
|
||||
use terminal_container_view::TerminalContainer;
|
||||
use util::ResultExt;
|
||||
use workspace::register_deserializable_item;
|
||||
|
||||
use std::{
|
||||
cmp::min,
|
||||
|
@ -67,6 +69,8 @@ use lazy_static::lazy_static;
|
|||
pub fn init(cx: &mut MutableAppContext) {
|
||||
terminal_view::init(cx);
|
||||
terminal_container_view::init(cx);
|
||||
|
||||
register_deserializable_item::<TerminalContainer>(cx);
|
||||
}
|
||||
|
||||
///Scrolling is unbearably sluggish by default. Alacritty supports a configurable
|
||||
|
|
|
@ -5,7 +5,7 @@ use alacritty_terminal::index::Point;
|
|||
use dirs::home_dir;
|
||||
use gpui::{
|
||||
actions, elements::*, AnyViewHandle, AppContext, Entity, ModelHandle, MutableAppContext, Task,
|
||||
View, ViewContext, ViewHandle,
|
||||
View, ViewContext, ViewHandle, WeakViewHandle,
|
||||
};
|
||||
use util::truncate_and_trailoff;
|
||||
use workspace::searchable::{SearchEvent, SearchOptions, SearchableItem, SearchableItemHandle};
|
||||
|
@ -13,6 +13,7 @@ use workspace::{
|
|||
item::{Item, ItemEvent},
|
||||
ToolbarItemLocation, Workspace,
|
||||
};
|
||||
use workspace::{register_deserializable_item, Pane};
|
||||
|
||||
use project::{LocalWorktree, Project, ProjectPath};
|
||||
use settings::{AlternateScroll, Settings, WorkingDirectory};
|
||||
|
@ -26,6 +27,8 @@ actions!(terminal, [DeployModal]);
|
|||
|
||||
pub fn init(cx: &mut MutableAppContext) {
|
||||
cx.add_action(TerminalContainer::deploy);
|
||||
|
||||
register_deserializable_item::<TerminalContainer>(cx);
|
||||
}
|
||||
|
||||
//Make terminal view an enum, that can give you views for the error and non-error states
|
||||
|
@ -127,7 +130,7 @@ impl TerminalContainer {
|
|||
TerminalContainerContent::Error(view)
|
||||
}
|
||||
};
|
||||
cx.focus(content.handle());
|
||||
// cx.focus(content.handle());
|
||||
|
||||
TerminalContainer {
|
||||
content,
|
||||
|
@ -375,6 +378,22 @@ impl Item for TerminalContainer {
|
|||
)
|
||||
.boxed()])
|
||||
}
|
||||
|
||||
fn serialized_item_kind() -> Option<&'static str> {
|
||||
Some("Terminal")
|
||||
}
|
||||
|
||||
fn deserialize(
|
||||
_project: ModelHandle<Project>,
|
||||
_workspace: WeakViewHandle<Workspace>,
|
||||
_workspace_id: workspace::WorkspaceId,
|
||||
_item_id: workspace::ItemId,
|
||||
cx: &mut ViewContext<Pane>,
|
||||
) -> Task<anyhow::Result<ViewHandle<Self>>> {
|
||||
// TODO: Pull the current working directory out of the DB.
|
||||
|
||||
Task::ready(Ok(cx.add_view(|cx| TerminalContainer::new(None, false, cx))))
|
||||
}
|
||||
}
|
||||
|
||||
impl SearchableItem for TerminalContainer {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue