From 028780cebccc135d67a9ff97fbb0b11a150608de Mon Sep 17 00:00:00 2001 From: Can Celik Date: Fri, 18 Sep 2026 21:50:26 +0300 Subject: fix: reveal selected agent when cycling the sidebar (#4355) * fix: reveal selected agent when cycling the sidebar * fix: reveal agent after endpoint activation --- src/client/shell/endpoint_agents.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/client/shell/endpoint_agents.rs') diff --git a/src/client/shell/endpoint_agents.rs b/src/client/shell/endpoint_agents.rs index 3cc106b3..b56b41fa 100644 --- a/src/client/shell/endpoint_agents.rs +++ b/src/client/shell/endpoint_agents.rs @@ -87,6 +87,41 @@ pub(super) fn render_expanded( ); } +impl ClientShellState { + pub(super) fn reveal_endpoint_agent( + &mut self, + endpoint_id: &ClientEndpointId, + pane_id: &str, + body_height: u16, + ) { + if body_height == 0 { + return; + } + let rows = agent_rows(&self.endpoints, &self.active_endpoint_id, &self.config); + let Some(target) = rows + .iter() + .position(|row| &row.endpoint_id == endpoint_id && row.agent.pane_id == pane_id) + else { + return; + }; + let heights = rows + .iter() + .map(|row| row.agent.rows.len().max(1).min(u16::MAX as usize) as u16) + .collect::>(); + let mut gaps = vec![self.config.agents.row_gap; rows.len()]; + if let Some(last) = gaps.last_mut() { + *last = 0; + } + self.agent_scroll = super::scroll::list_scroll_start_to_reveal( + &heights, + &gaps, + body_height, + self.agent_scroll, + target, + ); + } +} + struct EndpointAgentRow { endpoint_id: ClientEndpointId, machine_label: String, -- cgit v1.2.3