@@ -156,6 +156,10 @@ impl ProjectDiff {
.items_of_type::<Self>(cx)
.find(|item| matches!(item.read(cx).diff_base(cx), DiffBase::Head));
let project_diff = if let Some(existing) = existing {
+ existing.update(cx, |project_diff, cx| {
+ project_diff.move_to_beginning(window, cx);
+ });
+
workspace.activate_item(&existing, true, true, window, cx);
existing
} else {
@@ -365,6 +369,14 @@ impl ProjectDiff {
})
}
+ fn move_to_beginning(&mut self, window: &mut Window, cx: &mut Context<Self>) {
+ self.editor.update(cx, |editor, cx| {
+ editor.primary_editor().update(cx, |editor, cx| {
+ editor.move_to_beginning(&Default::default(), window, cx);
+ });
+ });
+ }
+
fn move_to_path(&mut self, path_key: PathKey, window: &mut Window, cx: &mut Context<Self>) {
if let Some(position) = self.multibuffer.read(cx).location_for_path(&path_key, cx) {
self.editor.update(cx, |editor, cx| {