From 4ffd99c2ec62fd3cbc9f9e0673d92c6a2a4f12b1 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Mon, 15 Jun 2026 04:56:03 +0300 Subject: fix: keep auto tab labels compact --- src/workspace/aggregate.rs | 21 ++++++++++++--------- src/workspace/tab.rs | 6 ------ 2 files changed, 12 insertions(+), 15 deletions(-) (limited to 'src/workspace') diff --git a/src/workspace/aggregate.rs b/src/workspace/aggregate.rs index bf4c9408..d1fcf984 100644 --- a/src/workspace/aggregate.rs +++ b/src/workspace/aggregate.rs @@ -30,7 +30,12 @@ impl Tab { }) } - pub fn pane_details(&self, terminals: &HashMap) -> Vec { + fn pane_details( + &self, + terminals: &HashMap, + tab_idx: usize, + tab_label: &str, + ) -> Vec { self.layout .pane_ids() .iter() @@ -48,8 +53,8 @@ impl Tab { let presentation = terminal.effective_presentation(); Some(PaneDetail { pane_id: *id, - tab_idx: 0, - tab_label: self.display_name(), + tab_idx, + tab_label: tab_label.to_string(), label: agent_label.clone(), agent_label, agent: terminal.effective_known_agent(), @@ -100,12 +105,10 @@ impl Workspace { .iter() .enumerate() .flat_map(|(tab_idx, tab)| { - tab.pane_details(terminals) - .into_iter() - .map(move |mut detail| { - detail.tab_idx = tab_idx; - detail - }) + let tab_label = self + .tab_display_name(tab_idx) + .unwrap_or_else(|| (tab_idx + 1).to_string()); + tab.pane_details(terminals, tab_idx, &tab_label).into_iter() }) .map(|mut detail| { if multi_tab { diff --git a/src/workspace/tab.rs b/src/workspace/tab.rs index 480bc329..3a339e57 100644 --- a/src/workspace/tab.rs +++ b/src/workspace/tab.rs @@ -185,12 +185,6 @@ impl Tab { )) } - pub fn display_name(&self) -> String { - self.custom_name - .clone() - .unwrap_or_else(|| self.number.to_string()) - } - pub fn is_auto_named(&self) -> bool { self.custom_name.is_none() } -- cgit v1.2.3