aboutsummaryrefslogtreecommitdiff
path: root/src/client/shell/endpoint_agents.rs
diff options
context:
space:
mode:
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,