From 168ff9992798b05c4fe392a3c7dbb1381fbb12da Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 24 May 2023 10:34:56 +0200 Subject: [PATCH] Prevent empty panes from being zoomed --- crates/workspace/src/pane.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index e1079f201b676286590d8b272cc4658d9c4777df..a2b13eb0ccce3b41bf08abfa3d5c45a7a9f6dbcf 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) { 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(); }