From eb962b7bfc15dd77c702cfcbf7dc32585e89749a Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 1 Oct 2024 13:05:50 -0400 Subject: [PATCH] editor: Include proposed changes editor in navigation history (#18593) This PR makes it so the proposed changes editor works with the workspace navigation history. This allows for easily navigating back to the proposed changes editor after opening one of the excerpts into the base buffer. Release Notes: - N/A --- crates/editor/src/proposed_changes_editor.rs | 22 +++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/proposed_changes_editor.rs b/crates/editor/src/proposed_changes_editor.rs index a791e87e62053f4ed0ddf6b81192ad3216387873..0666346e48776489008cb2b3d6bab1858ca4ff42 100644 --- a/crates/editor/src/proposed_changes_editor.rs +++ b/crates/editor/src/proposed_changes_editor.rs @@ -161,8 +161,28 @@ impl Item for ProposedChangesEditor { } fn added_to_workspace(&mut self, workspace: &mut Workspace, cx: &mut ViewContext) { + self.editor.update(cx, |editor, cx| { + Item::added_to_workspace(editor, workspace, cx) + }); + } + + fn deactivated(&mut self, cx: &mut ViewContext) { + self.editor.update(cx, Item::deactivated); + } + + fn navigate(&mut self, data: Box, cx: &mut ViewContext) -> bool { self.editor - .update(cx, |editor, cx| editor.added_to_workspace(workspace, cx)); + .update(cx, |editor, cx| Item::navigate(editor, data, cx)) + } + + fn set_nav_history( + &mut self, + nav_history: workspace::ItemNavHistory, + cx: &mut ViewContext, + ) { + self.editor.update(cx, |editor, cx| { + Item::set_nav_history(editor, nav_history, cx) + }); } }