Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

trying to fix the id issue

RoversX02c2b6d23042
diff --git a/mux/src/lib.rs b/mux/src/lib.rs
index 50e1e911..f0959cba 100644
--- a/mux/src/lib.rs
+++ b/mux/src/lib.rs
@@ -1345,9 +1345,6 @@ impl Mux {
.get_tab(tab_id)
.ok_or_else(|| anyhow!("tab_id {} invalid", tab_id))?;
- if tab.get_zoomed_pane().is_some() {
- anyhow::bail!("cannot create pane tab while zoomed");
- }
if tab.pane_index_for_pane(pane_id).is_none() {
anyhow::bail!("pane_id {} is not in tab {}", pane_id, tab_id);
}
diff --git a/mux/src/tab.rs b/mux/src/tab.rs
index 2349eecb..e1cc6100 100644
--- a/mux/src/tab.rs
+++ b/mux/src/tab.rs
@@ -2786,10 +2786,6 @@ impl TabInner {
base_pane_id: PaneId,
pane: Arc<dyn Pane>,
) -> anyhow::Result<usize> {
- if self.zoomed.is_some() {
- anyhow::bail!("cannot create pane tab while zoomed");
- }
-
let prior = self.get_active_pane();
let mut cursor = self.pane.take().unwrap().cursor();
let mut pane_index = 0;
@@ -2832,6 +2828,19 @@ impl TabInner {
self.active = pane_index;
self.recency.tag(pane_index);
+
+ // If the stack is zoomed, hand the zoom to the newly added pane so
+ // it becomes the fullscreen level-2 tab, mirroring what
+ // activate_zoomed_pane_in_stack does for tab switches.
+ if let Some(prior_zoomed) = self.zoomed.take() {
+ prior_zoomed.set_zoomed(false);
+ pane.set_zoomed(true);
+ if let Err(err) = pane.resize(self.size) {
+ log::error!("failed to resize zoomed pane: {err:#}");
+ }
+ self.zoomed.replace(pane);
+ }
+
self.advise_focus_change(prior);
Mux::try_get().map(|mux| mux.notify(MuxNotification::TabResized(self.id)));
@@ -3669,9 +3678,11 @@ mod test {
tab.set_zoomed(true);
assert_eq!(tab.get_zoomed_pane().unwrap().pane_id(), 103);
- assert!(tab
- .add_pane_to_stack(100, FakePane::new(104, size))
- .is_err());
+ // Adding a level-2 tab while zoomed hands the zoom to the new pane
+ tab.add_pane_to_stack(100, FakePane::new(104, size))
+ .unwrap();
+ assert_eq!(tab.get_active_pane().unwrap().pane_id(), 104);
+ assert_eq!(tab.get_zoomed_pane().unwrap().pane_id(), 104);
tab.activate_pane_in_stack(100).unwrap();
assert_eq!(tab.get_active_pane().unwrap().pane_id(), 100);
assert_eq!(tab.get_zoomed_pane().unwrap().pane_id(), 100);
diff --git a/wezterm-gui/src/termwindow/ui/sidebar.rs b/wezterm-gui/src/termwindow/ui/sidebar.rs
index 354714c1..4b08b554 100644
--- a/wezterm-gui/src/termwindow/ui/sidebar.rs
+++ b/wezterm-gui/src/termwindow/ui/sidebar.rs
@@ -682,7 +682,7 @@ impl crate::TermWindow {
if reconnect_in_flight {
"Connecting…"
} else {
- "Disconnected — Reconnect"
+ "Reconnect"
},
row_text_max,
)?;
diff --git a/wezterm-gui/src/workspace_threads.rs b/wezterm-gui/src/workspace_threads.rs
index 50073fc0..63116c90 100644
--- a/wezterm-gui/src/workspace_threads.rs
+++ b/wezterm-gui/src/workspace_threads.rs
@@ -3609,11 +3609,6 @@ pub fn adopt_orphan_remote_thread_windows(space_id: &str) -> bool {
let Some((project_id, thread_id)) = parse_thread_workspace_name(&workspace) else {
continue;
};
- // Mux-domain "main" projects embed a Space id and are ensured by
- // ensure_mux_domain_space; never duplicate them here.
- if project_id.contains(REMOTE_PROJECT_SPACE_SEPARATOR) {
- continue;
- }
if candidates.iter().any(|(_, _, ws, _)| ws == &workspace) {
continue;
}
@@ -3630,6 +3625,8 @@ pub fn adopt_orphan_remote_thread_windows(space_id: &str) -> bool {
return false;
}
+ let mux_project_id = remote_project_id_for_space(space_id, &mux_domain_host_id(&domain_name));
+
let mut store = THREAD_STORE.lock();
let mut changed = false;
for (project_id, thread_id, workspace, cwd) in candidates {
@@ -3657,6 +3654,45 @@ pub fn adopt_orphan_remote_thread_windows(space_id: &str) -> bool {
project.threads.push(thread);
changed = true;
}
+ // Mux-domain workspace names embed a Space id. When that identity
+ // no longer matches any local project (the Space was recreated,
+ // the store was lost, the domain was relabelled), the session
+ // would otherwise keep running invisibly on the server forever.
+ // Re-home it as a thread of THIS Space's mux-domain project; the
+ // materialized workspace name keeps routing to the live remote
+ // workspace.
+ None if project_id.contains(REMOTE_PROJECT_SPACE_SEPARATOR) => {
+ let thread_id_taken = store
+ .projects
+ .iter()
+ .any(|project| project.threads.iter().any(|thread| thread.id == thread_id));
+ if !store.projects.iter().any(|project| project.id == mux_project_id) {
+ store.projects.push(Project {
+ id: mux_project_id.clone(),
+ space_id: space_id.to_string(),
+ name: domain_name.clone(),
+ path: PathBuf::from(format!("wezterm-mux://{domain_name}")),
+ threads: vec![],
+ active_thread_id: None,
+ threads_collapsed: false,
+ });
+ }
+ let project = store
+ .projects
+ .iter_mut()
+ .find(|project| project.id == mux_project_id)
+ .expect("mux domain project was just ensured");
+ let mut thread = WorkspaceThread::new(
+ mux_project_id.clone(),
+ "main".to_string(),
+ Some(workspace),
+ );
+ if !thread_id_taken {
+ thread.id = thread_id;
+ }
+ project.threads.push(thread);
+ changed = true;
+ }
None => {
let path = cwd.filter(|p| !p.is_empty()).unwrap_or_else(|| "~".to_string());
let name = Path::new(&path)