terminal: Persist pinned tabs in terminal (#31921)

Closes #31098

Release Notes:

- Fixed terminal pinned tab state not persisting across restarts.
This commit is contained in:
Piotr Osiewicz 2025-06-02 22:36:57 +02:00 committed by GitHub
parent 3f90bc81bd
commit f1aab1120d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 4 deletions

View file

@ -74,10 +74,12 @@ fn serialize_pane(pane: &Entity<Pane>, active: bool, cx: &mut App) -> Serialized
.map(|item| item.item_id().as_u64())
.filter(|active_id| items_to_serialize.contains(active_id));
let pinned_count = pane.pinned_count();
SerializedPane {
active,
children,
active_item,
pinned_count,
}
}
@ -229,10 +231,11 @@ async fn deserialize_pane_group(
})
.log_err()?;
let active_item = serialized_pane.active_item;
let pinned_count = serialized_pane.pinned_count;
let terminal = pane
.update_in(cx, |pane, window, cx| {
populate_pane_items(pane, new_items, active_item, window, cx);
pane.set_pinned_count(pinned_count);
// Avoid blank panes in splits
if pane.items_len() == 0 {
let working_directory = workspace
@ -339,6 +342,8 @@ pub(crate) struct SerializedPane {
pub active: bool,
pub children: Vec<u64>,
pub active_item: Option<u64>,
#[serde(default)]
pub pinned_count: usize,
}
#[derive(Debug)]

View file

@ -325,7 +325,6 @@ impl TerminalPanel {
.ok();
}
}
Ok(terminal_panel)
}
@ -393,6 +392,9 @@ impl TerminalPanel {
pane::Event::Focus => {
self.active_pane = pane.clone();
}
pane::Event::ItemPinned | pane::Event::ItemUnpinned => {
self.serialize(cx);
}
_ => {}
}