From f4db68637dfce14181332d8023308a3b3e9f863f Mon Sep 17 00:00:00 2001 From: Quan Tong Date: Tue, 29 Aug 2023 10:10:38 +0700 Subject: [PATCH] check the zoom state before unzooming --- wezterm-mux-server-impl/src/sessionhandler.rs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/wezterm-mux-server-impl/src/sessionhandler.rs b/wezterm-mux-server-impl/src/sessionhandler.rs index 977c6a7b7..b9dcc7e1c 100644 --- a/wezterm-mux-server-impl/src/sessionhandler.rs +++ b/wezterm-mux-server-impl/src/sessionhandler.rs @@ -532,10 +532,23 @@ impl SessionHandler { let tab = mux .get_tab(containing_tab_id) .ok_or_else(|| anyhow!("no such tab {}", containing_tab_id))?; - tab.set_zoomed(false); - if zoomed { - tab.set_active_pane(&pane); - tab.set_zoomed(zoomed); + match tab.get_zoomed_pane() { + Some(p) => { + let is_zoomed = p.pane_id() == pane_id; + if is_zoomed != zoomed { + tab.set_zoomed(false); + if zoomed { + tab.set_active_pane(&pane); + tab.set_zoomed(zoomed); + } + } + } + None => { + if zoomed { + tab.set_active_pane(&pane); + tab.set_zoomed(zoomed); + } + } } Ok(Pdu::UnitResponse(UnitResponse {})) },