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.

Prevent empty panes from being zoomed

Antonio Scandurra168ff9992798
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs
index e1079f201b6..a2b13eb0ccc 100644
--- a/crates/workspace/src/pane.rs
+++ b/crates/workspace/src/pane.rs
@@ -683,7 +683,7 @@ impl Pane {
pub fn toggle_zoom(&mut self, _: &ToggleZoom, cx: &mut ViewContext<Self>) {
if self.zoomed {
cx.emit(Event::ZoomOut);
- } else {
+ } else if !self.items.is_empty() {
cx.emit(Event::ZoomIn);
}
}
@@ -983,6 +983,10 @@ impl Pane {
.remove(&item.id());
}
+ if self.items.is_empty() && self.zoomed {
+ cx.emit(Event::ZoomOut);
+ }
+
cx.notify();
}