diff --git a/docs/changelog.md b/docs/changelog.md index 3aa852eee..3306952ed 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -36,6 +36,7 @@ As features stabilize some brief notes about them will accumulate here. * Malformed XTGETTCAP response. [#1781](https://github.com/wez/wezterm/issues/1781) * Multiplexer performance with images was unusuable for all but tiny images. [#1237](https://github.com/wez/wezterm/issues/1237) * `CloseCurrentPane{confirm=false}` would leave behind a phantom tab/pane when used with the multiplexer. [#1277](https://github.com/wez/wezterm/issues/1277) +* `CloseCurrentPane{confirm=true}` artifacts when used with the multiplexer. [#783](https://github.com/wez/wezterm/issues/783) ### 20220319-142410-0fcdea07 diff --git a/wezterm-client/src/pane/clientpane.rs b/wezterm-client/src/pane/clientpane.rs index 50663c6d6..238461de3 100644 --- a/wezterm-client/src/pane/clientpane.rs +++ b/wezterm-client/src/pane/clientpane.rs @@ -1,4 +1,4 @@ -use crate::domain::ClientInner; +use crate::domain::{ClientDomain, ClientInner}; use crate::pane::mousestate::MouseState; use crate::pane::renderable::{hydrate_lines, RenderableInner, RenderableState}; use anyhow::bail; @@ -372,13 +372,29 @@ impl Pane for ClientPane { } let client = Arc::clone(&self.client); let remote_pane_id = self.remote_pane_id; + let local_domain_id = self.client.local_domain_id; promise::spawn::spawn(async move { client .client .kill_pane(KillPane { pane_id: remote_pane_id, }) - .await + .await?; + + // Arrange to resync the layout, to avoid artifacts + // + let mux = Mux::get().expect("called on main thread"); + let client_domain = mux + .get_domain(local_domain_id) + .ok_or_else(|| anyhow::anyhow!("no such domain {}", local_domain_id))?; + let client_domain = client_domain + .downcast_ref::() + .ok_or_else(|| { + anyhow::anyhow!("domain {} is not a ClientDomain instance", local_domain_id) + })?; + + client_domain.resync().await?; + anyhow::Result::<()>::Ok(()) }) .detach(); // Explicitly mark ourselves as dead.