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.

pane: Update pinned tab counts when unnamed buffer is discarded (#20294)

Piotr Osiewiczfef7df667c71
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs
index 97672fd2455..b37298c7cac 100644
--- a/crates/workspace/src/pane.rs
+++ b/crates/workspace/src/pane.rs
@@ -1593,8 +1593,13 @@ impl Pane {
Ok(0) => {}
Ok(1) => {
// Don't save this file
- pane.update(cx, |_, cx| item.discarded(project, cx))
- .log_err();
+ pane.update(cx, |pane, cx| {
+ if pane.is_tab_pinned(item_ix) && !item.can_save(cx) {
+ pane.pinned_tab_count -= 1;
+ }
+ item.discarded(project, cx)
+ })
+ .log_err();
return Ok(true);
}
_ => return Ok(false), // Cancel