1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00

mux: spawn pane if needed when using launcher to attach

If we had previously killed all the panes in a remote mux,
and then reconnected to it using the launcher menu attach option,
we could end up in a confusing state where we connect but don't
show anything for the remote; it looks like nothing happened
even though it is legitimately showing the empty remote mux.

This commit checks for that case and spawns the default program
in the remote if there are no panes.
This commit is contained in:
Wez Furlong 2022-04-17 18:24:46 -07:00
parent 7afc9e4d56
commit b375886073

View File

@ -620,7 +620,21 @@ fn do_domain_attach(domain: DomainId, window: WindowId) {
let domain = mux let domain = mux
.get_domain(domain) .get_domain(domain)
.ok_or_else(|| anyhow!("launcher attach called with unresolvable domain id!?"))?; .ok_or_else(|| anyhow!("launcher attach called with unresolvable domain id!?"))?;
domain.attach(Some(window)).await domain.attach(Some(window)).await?;
let have_panes_in_domain = mux
.iter_panes()
.iter()
.any(|p| p.domain_id() == domain.domain_id());
if !have_panes_in_domain {
let config = config::configuration();
let _tab = domain
.spawn(config.initial_size(), None, None, window)
.await?;
}
Result::<(), anyhow::Error>::Ok(())
}) })
.detach(); .detach();
} }