pane: Serialize pinned tab state (#17670)

Release Notes:

- Tab pin state is now persisted across Zed runs.
This commit is contained in:
Piotr Osiewicz 2024-09-10 19:19:21 -04:00 committed by GitHub
parent d1a47faeb7
commit f374038da0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 11 deletions

View file

@ -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)
}