fix diff hunk boundary check

Cole Miller created

Change summary

crates/multi_buffer/src/anchor.rs       | 11 +----------
crates/multi_buffer/src/multi_buffer.rs |  8 +++++++-
2 files changed, 8 insertions(+), 11 deletions(-)

Detailed changes

crates/multi_buffer/src/anchor.rs 🔗

@@ -12,7 +12,7 @@ use std::{
 use sum_tree::Bias;
 
 /// A multibuffer anchor derived from an anchor into a specific excerpted buffer.
-#[derive(Clone, Copy, Eq, PartialEq, Hash)]
+#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
 pub struct ExcerptAnchor {
     pub(crate) text_anchor: text::Anchor,
     pub(crate) path: PathKeyIndex,
@@ -30,15 +30,6 @@ pub enum Anchor {
     Max,
 }
 
-impl std::fmt::Debug for ExcerptAnchor {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        f.debug_struct("Anchor")
-            .field("text_anchor", &self.text_anchor)
-            .field("diff_base_anchor", &self.diff_base_anchor)
-            .finish()
-    }
-}
-
 // todo!() should this take a lifetime?
 pub(crate) enum AnchorSeekTarget {
     Min,

crates/multi_buffer/src/multi_buffer.rs 🔗

@@ -2419,13 +2419,19 @@ impl MultiBuffer {
             for diff_hunk in snapshot.diff_hunks_in_range(range) {
                 if diff_hunk
                     .multi_buffer_range()
-                    .end
+                    .start
                     .cmp(&excerpt_end, &snapshot)
                     .is_gt()
                 {
+                    dbg!("NOT EXPANDING", diff_hunk.multi_buffer_range(), excerpt_end);
+                    dbg!(
+                        diff_hunk.multi_buffer_range().end.to_point(&snapshot),
+                        excerpt_end.to_point(&snapshot)
+                    );
                     continue;
                 }
                 if last_hunk_row.is_some_and(|row| row >= diff_hunk.row_range.start) {
+                    dbg!("OTHER CONTINUE");
                     continue;
                 }
                 let range = diff_hunk.multi_buffer_range();