diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index 0fa0557e9c5f196862d87a9ff1c61cfd0cd19d7d..c2055775035e77936cc310a66c2cf0e35e4e120c 100644 --- a/crates/assistant/src/assistant_panel.rs +++ b/crates/assistant/src/assistant_panel.rs @@ -595,7 +595,7 @@ impl AssistantPanel { true } - pane::Event::ActivateItem { local } => { + pane::Event::ActivateItem { local, .. } => { if *local { self.workspace .update(cx, |workspace, cx| { diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 607d5b7bcc39064292b1d92ab101ad95940be053..d1b8acb22d349617941ba1547553452b10ed897a 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -206,6 +206,7 @@ pub enum Event { }, ActivateItem { local: bool, + focus_changed: bool, }, Remove { focus_on_pane: Option>, @@ -236,7 +237,7 @@ impl fmt::Debug for Event { .debug_struct("AddItem") .field("item", &item.item_id()) .finish(), - Event::ActivateItem { local } => f + Event::ActivateItem { local, .. } => f .debug_struct("ActivateItem") .field("local", local) .finish(), @@ -1092,9 +1093,6 @@ impl Pane { prev_item.deactivated(cx); } } - cx.emit(Event::ActivateItem { - local: activate_pane, - }); if let Some(newly_active_item) = self.items.get(index) { self.activation_history @@ -1114,6 +1112,11 @@ impl Pane { self.focus_active_item(cx); } + cx.emit(Event::ActivateItem { + local: activate_pane, + focus_changed: focus_item, + }); + if !self.is_tab_pinned(index) { self.tab_bar_scroll_handle .scroll_to_item(index - self.pinned_tab_count); diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 3a4f52cd02112e6924047b37d0ff54db34d66fe4..4a1166270558be016e30729892408f7b062e2cd4 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -3101,7 +3101,10 @@ impl Workspace { pane::Event::Remove { focus_on_pane } => { self.remove_pane(pane, focus_on_pane.clone(), cx); } - pane::Event::ActivateItem { local } => { + pane::Event::ActivateItem { + local, + focus_changed, + } => { cx.on_next_frame(|_, cx| { cx.invalidate_character_coordinates(); }); @@ -3116,6 +3119,7 @@ impl Workspace { self.active_item_path_changed(cx); self.update_active_view_for_followers(cx); } + serialize_workspace = *focus_changed || &pane != self.active_pane(); } pane::Event::UserSavedItem { item, save_intent } => { cx.emit(Event::UserSavedItem {