From a754bdb8dbb6aca7a2b6507c421a14fe2cc020bf Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Mon, 4 May 2026 07:25:20 -0400 Subject: [PATCH] fix --- crates/agent_ui/src/agent_diff.rs | 28 +++++++++++++--------------- crates/editor/src/split.rs | 12 ++++++++++++ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/crates/agent_ui/src/agent_diff.rs b/crates/agent_ui/src/agent_diff.rs index 04951fcbe7c8f2..4a5771fd9810fe 100644 --- a/crates/agent_ui/src/agent_diff.rs +++ b/crates/agent_ui/src/agent_diff.rs @@ -173,19 +173,17 @@ impl AgentDiffPane { .map(|diff_hunk| diff_hunk.buffer_range.to_point(&snapshot)) .collect::>(); - let (was_empty, is_excerpt_newly_added) = - self.multibuffer.update(cx, |multibuffer, cx| { - let was_empty = multibuffer.is_empty(); - let is_excerpt_newly_added = multibuffer.update_excerpts_for_path( - path_key.clone(), - buffer.clone(), - diff_hunk_ranges, - multibuffer_context_lines(cx), - cx, - ); - multibuffer.add_diff(diff_handle.clone(), cx); - (was_empty, is_excerpt_newly_added) - }); + let was_empty = self.multibuffer.read(cx).is_empty(); + let is_excerpt_newly_added = self.editor.update(cx, |editor, cx| { + editor.update_excerpts_for_path( + path_key.clone(), + buffer.clone(), + diff_hunk_ranges, + multibuffer_context_lines(cx), + diff_handle.clone(), + cx, + ) + }); let rhs_editor = self.editor.read(cx).rhs_editor().clone(); rhs_editor.update(cx, |editor, cx| { @@ -216,9 +214,9 @@ impl AgentDiffPane { }); } - self.multibuffer.update(cx, |multibuffer, cx| { + self.editor.update(cx, |editor, cx| { for buffer_id in buffers_to_delete { - multibuffer.remove_excerpts_for_buffer(buffer_id, cx); + editor.remove_excerpts_for_buffer(buffer_id, cx); } }); diff --git a/crates/editor/src/split.rs b/crates/editor/src/split.rs index 42f485a236b40c..8f7ef224c53388 100644 --- a/crates/editor/src/split.rs +++ b/crates/editor/src/split.rs @@ -1280,6 +1280,18 @@ impl SplittableEditor { } } } + + pub fn remove_excerpts_for_buffer( + &mut self, + buffer_id: BufferId, + cx: &mut Context<'_, SplittableEditor>, + ) { + let snapshot = self.rhs_multibuffer.read(cx).snapshot(cx); + let Some(path) = snapshot.path_for_buffer(buffer_id) else { + return; + }; + self.remove_excerpts_for_path(path.clone(), cx); + } } #[cfg(test)]