From 5d12e3ce3a318577ff09811bdf57c91674b1beea Mon Sep 17 00:00:00 2001 From: Bennet Bo Fenner Date: Fri, 20 Sep 2024 14:43:26 -0400 Subject: [PATCH] preview tabs: Toggle preview tab when saving (#18158) Release Notes: - Saving a preview tab will now mark it as a permanent tab --- crates/workspace/src/pane.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index a5f83f961f0400cf73ce9ee3769ac1f2ce3edb05..82300690e7dbe126ef944c19caabd162f086d8b6 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1595,8 +1595,13 @@ impl Pane { } if can_save { - pane.update(cx, |_, cx| item.save(should_format, project, cx))? - .await?; + pane.update(cx, |pane, cx| { + if pane.is_active_preview_item(item.item_id()) { + pane.set_preview_item_id(None, cx); + } + item.save(should_format, project, cx) + })? + .await?; } else if can_save_as { let abs_path = pane.update(cx, |pane, cx| { pane.workspace