aboutsummaryrefslogtreecommitdiff
path: root/src/client/shell/endpoints.rs
diff options
context:
space:
mode:
authorEric Yue <jiacheng.yue@foxmail.com>2026-09-14 20:46:39 +0800
committerGitHub <noreply@github.com>2026-09-14 15:46:39 +0300
commitbe03b7a19f198dba2cbf28a5b291b1157e8717c9 (patch)
tree97815a5f31d46265a079e70814ad473dcdda9720 /src/client/shell/endpoints.rs
parentc77af1892ff121736ecb103b32d504d6f1b31805 (diff)
fix: preserve agent panel scroll when switching machines (#4101)
refs #3937 Root cause: Activating another endpoint applies a snapshot with a different endpoint-qualified graphics scope. This triggers reset_endpoint_projection, which clears agent_scroll together with endpoint-local state even though the agent list aggregates all machines. The selected agent receives focus, but the list jumps back to the top. Fix: Save the client-owned agent scroll offset and restore it only when activation changes endpoints. Keep same-endpoint reboot resets, workspace/tab scroll resets, input cleanup and existing list bounds clamping unchanged. This adds constant-time work on endpoint activation, with no protocol, persisted-state or pane-scaled rendering changes. Validation: The new regression fails on the original implementation with scroll 0 instead of 6. Tests cover repeated bidirectional agent clicks, stable visible rows, shrinking lists and same-machine reboots. All 242 client shell tests pass. Real SSH A/B testing against the same two disposable 0.9.0 servers reproduces the reset with both the stable and current-master clients. The patched client preserves the visible rows through six cross-machine switches and two same-machine control clicks. Native just ci passes: 3535 Rust tests, six default skips, plus lint, maintenance, architecture and integration-asset checks. All seven docs contract tests pass. Windows cross-lint was not run because its SDK is not installed; native macOS and Windows UI behavior was not tested.
Diffstat (limited to 'src/client/shell/endpoints.rs')
-rw-r--r--src/client/shell/endpoints.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/shell/endpoints.rs b/src/client/shell/endpoints.rs
index 420f7131..d3823d54 100644
--- a/src/client/shell/endpoints.rs
+++ b/src/client/shell/endpoints.rs
@@ -208,12 +208,18 @@ impl ClientShellState {
let Some(snapshot) = endpoint.snapshot.clone() else {
return false;
};
- if endpoint_id != &self.active_endpoint_id {
+ let switching_endpoint = endpoint_id != &self.active_endpoint_id;
+ let agent_scroll = self.agent_scroll;
+ if switching_endpoint {
self.active_endpoint_id = endpoint_id.clone();
self.pane_surface = None;
self.pending_pane_surface = None;
}
self.apply_active_snapshot(snapshot);
+ if switching_endpoint {
+ // The aggregate agent list belongs to the client, not one endpoint.
+ self.agent_scroll = agent_scroll;
+ }
true
}