pane: Serialize pinned tab state (#17670)
Release Notes: - Tab pin state is now persisted across Zed runs.
This commit is contained in:
parent
d1a47faeb7
commit
f374038da0
4 changed files with 49 additions and 11 deletions
|
@ -297,6 +297,7 @@ impl Default for SerializedPaneGroup {
|
|||
Self::Pane(SerializedPane {
|
||||
children: vec![SerializedItem::default()],
|
||||
active: false,
|
||||
pinned_count: 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -379,11 +380,16 @@ impl SerializedPaneGroup {
|
|||
pub struct SerializedPane {
|
||||
pub(crate) active: bool,
|
||||
pub(crate) children: Vec<SerializedItem>,
|
||||
pub(crate) pinned_count: usize,
|
||||
}
|
||||
|
||||
impl SerializedPane {
|
||||
pub fn new(children: Vec<SerializedItem>, active: bool) -> Self {
|
||||
SerializedPane { children, active }
|
||||
pub fn new(children: Vec<SerializedItem>, active: bool, pinned_count: usize) -> Self {
|
||||
SerializedPane {
|
||||
children,
|
||||
active,
|
||||
pinned_count,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn deserialize_to(
|
||||
|
@ -442,6 +448,9 @@ impl SerializedPane {
|
|||
}
|
||||
})?;
|
||||
}
|
||||
pane.update(cx, |pane, _| {
|
||||
pane.set_pinned_count(self.pinned_count);
|
||||
})?;
|
||||
|
||||
anyhow::Ok(items)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue