From 44af405fb0c48327074fd0ae97b7e3d7a08a6265 Mon Sep 17 00:00:00 2001 From: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> Date: Thu, 2 Jan 2025 13:09:35 +0900 Subject: [PATCH] pane: Turn off preview mode when pinning a tab (#22501) I opened the tab in preview mode, pinned it, then I opened another file, but its tab unexpectedly closed. https://github.com/user-attachments/assets/b857382e-f0ad-4d5a-9036-19de01663c97 Pinning a tab now turns off preview mode. https://github.com/user-attachments/assets/e34b7c7f-452b-4f36-99c1-e0c68429225c Release Notes: - Pinning a preview tab will now turn off preview mode --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> Co-authored-by: Bennet Bo Fenner --- crates/workspace/src/pane.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 3f76843181005893a317e52c7521b092896b6ccb..33808ffb3cfe3fada03f6627d1df0c19700f3e81 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1961,6 +1961,10 @@ impl Pane { self.pinned_tab_count += 1; let id = self.item_for_index(ix)?.item_id(); + if self.is_active_preview_item(id) { + self.set_preview_item_id(None, cx); + } + self.workspace .update(cx, |_, cx| { cx.defer(move |_, cx| move_item(&pane, &pane, id, destination_index, cx));