@@ -25,7 +25,8 @@ use crate::{
use workspace::{ActivatePaneLeft, ActivatePaneRight, Item, Workspace};
use crate::{
- Autoscroll, DisplayMap, Editor, EditorEvent, ToggleCodeActions, ToggleSoftWrap,
+ Autoscroll, DisplayMap, Editor, EditorEvent, RenderDiffHunkControlsFn, ToggleCodeActions,
+ ToggleSoftWrap,
actions::{DisableBreakpoint, EditLogBreakpoint, EnableBreakpoint, ToggleBreakpoint},
display_map::Companion,
};
@@ -308,6 +309,22 @@ impl SplittableEditor {
self.lhs.is_some()
}
+ pub fn set_render_diff_hunk_controls(
+ &self,
+ render_diff_hunk_controls: RenderDiffHunkControlsFn,
+ cx: &mut Context<Self>,
+ ) {
+ self.rhs_editor.update(cx, |editor, cx| {
+ editor.set_render_diff_hunk_controls(render_diff_hunk_controls.clone(), cx);
+ });
+
+ if let Some(lhs) = &self.lhs {
+ lhs.editor.update(cx, |editor, cx| {
+ editor.set_render_diff_hunk_controls(render_diff_hunk_controls.clone(), cx);
+ });
+ }
+ }
+
pub fn last_selected_editor(&self) -> &Entity<Editor> {
if let Some(lhs) = &self.lhs
&& lhs.has_latest_selection
@@ -395,6 +412,8 @@ impl SplittableEditor {
multibuffer.set_all_diff_hunks_expanded(cx);
multibuffer
});
+
+ let render_diff_hunk_controls = self.rhs_editor.read(cx).render_diff_hunk_controls.clone();
let lhs_editor = cx.new(|cx| {
let mut editor =
Editor::for_multibuffer(lhs_multibuffer.clone(), Some(project.clone()), window, cx);
@@ -406,6 +425,10 @@ impl SplittableEditor {
editor
});
+ lhs_editor.update(cx, |editor, cx| {
+ editor.set_render_diff_hunk_controls(render_diff_hunk_controls, cx);
+ });
+
let subscriptions =
vec![cx.subscribe(
&lhs_editor,
@@ -288,6 +288,13 @@ impl ProjectDiff {
window,
cx,
);
+ match branch_diff.read(cx).diff_base() {
+ DiffBase::Head => {}
+ DiffBase::Merge { .. } => diff_display_editor.set_render_diff_hunk_controls(
+ Arc::new(|_, _, _, _, _, _, _, _| gpui::Empty.into_any_element()),
+ cx,
+ ),
+ }
diff_display_editor.rhs_editor().update(cx, |editor, cx| {
editor.disable_diagnostics(cx);
editor.set_show_diff_review_button(true, cx);
@@ -303,10 +310,6 @@ impl ProjectDiff {
branch_diff: branch_diff.clone(),
});
editor.start_temporary_diff_override();
- editor.set_render_diff_hunk_controls(
- Arc::new(|_, _, _, _, _, _, _, _| gpui::Empty.into_any_element()),
- cx,
- );
}
}
});