diff options
| author | Eric Yue <jiacheng.yue@foxmail.com> | 2026-09-15 21:48:58 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-15 17:48:58 +0400 |
| commit | 7808478d3bc7004b05aa41665ca11efb208033bd (patch) | |
| tree | bfaffaa386c7b22f5af5b3a0a707054d13645370 /src | |
| parent | 35707684b9de1b2e2b6be5de5a49e69ad57ac36b (diff) | |
fix: reconcile client locations after no-focus pane moves (#4171)
refs #4153
Root cause:
A no-focus pane move can remove the source tab without changing the
server's numeric workspace and tab coordinates. PaneMove is not classified
as a topology change, so a client viewing that tab retains its deleted ID.
Its target lookup falls back to the server default and can follow a later,
unrelated focus change instead of staying in the source workspace.
Fix:
Include PaneMove in the existing client-location reconciliation path.
Extend the existing focus-guard test with a client on the removed tab and
verify that a later server-default change cannot move its view. Preserve
the other client's view and existing error, no-op and zoom assertions.
Validation:
The minimized regression fails five times on PR #4159's unchanged head and
passes five times with the one-line fix. All 19 pane-move tests, native
lint, maintenance, architecture and integration-asset checks pass.
Full native just ci on the publication branch, including the unchanged
prerequisites from #4159 and #4168, passes 3585 Rust tests with six default
skips plus lint, 106 maintenance, six architecture and 39 integration-asset
tests. All seven docs contract tests pass. Local Windows cross-lint was
not run because its SDK is unavailable.
No geometry policy, protocol or periodic rendering behavior is changed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/headless/client_views.rs | 1 | ||||
| -rw-r--r-- | src/server/headless/tests/pane_move.rs | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/server/headless/client_views.rs b/src/server/headless/client_views.rs index bb697b9a..d6030f74 100644 --- a/src/server/headless/client_views.rs +++ b/src/server/headless/client_views.rs @@ -230,6 +230,7 @@ impl HeadlessServer { Method::CommandInvoke(_) | Method::PaneClose(_) | Method::PaneEditScrollback(_) + | Method::PaneMove(_) | Method::PaneSplit(_) | Method::TabClose(_) | Method::TabCreate(_) diff --git a/src/server/headless/tests/pane_move.rs b/src/server/headless/tests/pane_move.rs index 93bff0c9..c18d0f1f 100644 --- a/src/server/headless/tests/pane_move.rs +++ b/src/server/headless/tests/pane_move.rs @@ -185,6 +185,7 @@ async fn public_pane_move_without_effective_focus_preserves_client_views() { let remaining_tab = server.app.public_tab_id(0, 1).unwrap(); let destination_tab = server.app.public_tab_id(1, 0).unwrap(); let (_control, _render) = connect_test_shell(&mut server, 9, 80, 23); + let (_source_control, _source_render) = connect_test_shell(&mut server, 10, 80, 23); // Keep a valid view distinct from the server default in every case. assert!(server.focus_shell_client_on_tab(9, &remaining_tab)); let location_before = server.clients[&9].shell_location.clone(); @@ -221,6 +222,15 @@ async fn public_pane_move_without_effective_focus_preserves_client_views() { "{case}" ); assert_eq!(server.app.state.active, Some(0)); + if case == "no-focus" { + // A later change to the server default must not move this client. + server.app.state.switch_workspace_tab(1, 0); + assert_eq!( + server.shell_tab_id_for_client(10).as_deref(), + Some(remaining_tab.as_str()), + "the removed source tab must be reconciled to the remaining source tab" + ); + } shutdown_test_runtimes(&mut server); } } |
