diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 768432ef75af1958c90e580bc2fec189dc5763e8..eb12de9b727bb6ea9c6b87047ffeab23372221ea 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -4561,6 +4561,29 @@ mod tests { }) .await; + // When client A navigates back and forth, client B does so as well. + workspace_a + .update(cx_a, |workspace, cx| { + workspace::Pane::go_back(workspace, None, cx) + }) + .await; + workspace_b + .condition(cx_b, |workspace, cx| { + workspace.active_item(cx).unwrap().id() == editor_b2.id() + }) + .await; + + workspace_a + .update(cx_a, |workspace, cx| { + workspace::Pane::go_forward(workspace, None, cx) + }) + .await; + workspace_b + .condition(cx_b, |workspace, cx| { + workspace.active_item(cx).unwrap().id() == editor_b1.id() + }) + .await; + // Changes to client A's editor are reflected on client B. editor_a1.update(cx_a, |editor, cx| { editor.select_ranges([1..1, 2..2], None, cx); diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 1421072b131e4ed72f05547edb1e30080f8ef2ce..66b87c310e348c15d337da7b63df1716b8707d09 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -206,10 +206,6 @@ impl Pane { } let prev_active_index = mem::replace(&mut pane.active_item_index, index); - pane.focus_active_item(cx); - pane.update_toolbar(cx); - cx.emit(Event::ActivateItem { local: true }); - cx.notify(); let mut navigated = prev_active_index != pane.active_item_index; if let Some(data) = entry.data { @@ -217,6 +213,11 @@ impl Pane { } if navigated { + pane.focus_active_item(cx); + pane.update_toolbar(cx); + pane.activate(cx); + cx.emit(Event::ActivateItem { local: true }); + cx.notify(); break None; } }