Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

preview tabs: Toggle preview tab when saving (#18158)

Bennet Bo Fenner5d12e3ce3a31
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs
index a5f83f961f0..82300690e7d 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