1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00

mux: fix artifacts in multi-pane layouts after closing a pane

refs: https://github.com/wez/wezterm/issues/1277
refs: https://github.com/wez/wezterm/issues/783
This commit is contained in:
Wez Furlong 2022-03-28 22:45:19 -07:00
parent b398eaf656
commit f478672fd8
2 changed files with 19 additions and 2 deletions

View File

@ -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

View File

@ -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
// <https://github.com/wez/wezterm/issues/1277>
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::<ClientDomain>()
.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.