aboutsummaryrefslogtreecommitdiff
path: root/src/client/shell/endpoint_agents.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-18 21:50:26 +0300
committerGitHub <noreply@github.com>2026-09-18 21:50:26 +0300
commit028780cebccc135d67a9ff97fbb0b11a150608de (patch)
treeb4282db58167539473fa1f0a7f4acd569db9ec53 /src/client/shell/endpoint_agents.rs
parent241063f7ffb9583ba9b3438b32a82fcec3cf32a3 (diff)
fix: reveal selected agent when cycling the sidebar (#4355)
* fix: reveal selected agent when cycling the sidebar * fix: reveal agent after endpoint activation
Diffstat (limited to 'src/client/shell/endpoint_agents.rs')
-rw-r--r--src/client/shell/endpoint_agents.rs35
1 files changed, 35 insertions, 0 deletions
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::<Vec<_>>();
+ 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,